소스 검색

Implement tests for Account#refresh! (#5601)

master
ysksn 6 년 전
committed by Yamagishi Kazutoshi
부모
커밋
d307ee79e9
1개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. +27
    -0
      spec/models/account_spec.rb

+ 27
- 0
spec/models/account_spec.rb 파일 보기

@@ -174,6 +174,33 @@ RSpec.describe Account, type: :model do
end
end

describe '#refresh!' do
let(:account) { Fabricate(:account, domain: domain) }
let(:acct) { account.acct }

context 'domain is nil' do
let(:domain) { nil }

it 'returns nil' do
expect(account.refresh!).to be_nil
end

it 'calls not ResolveRemoteAccountService#call' do
expect_any_instance_of(ResolveRemoteAccountService).not_to receive(:call).with(acct)
account.refresh!
end
end

context 'domain is present' do
let(:domain) { 'example.com' }

it 'calls ResolveRemoteAccountService#call' do
expect_any_instance_of(ResolveRemoteAccountService).to receive(:call).with(acct).once
account.refresh!
end
end
end

describe '#to_param' do
it 'returns username' do
account = Fabricate(:account, username: 'alice')


불러오는 중...
취소
저장