Fix RSpec/VerifiedDoubles
cop (#25469)
This commit is contained in:
parent
38433ccd0b
commit
05f9e39b32
50 changed files with 162 additions and 172 deletions
|
@ -9,7 +9,8 @@ describe ActivityPub::ProcessingWorker do
|
|||
|
||||
describe '#perform' do
|
||||
it 'delegates to ActivityPub::ProcessCollectionService' do
|
||||
allow(ActivityPub::ProcessCollectionService).to receive(:new).and_return(double(:service, call: nil))
|
||||
allow(ActivityPub::ProcessCollectionService).to receive(:new)
|
||||
.and_return(instance_double(ActivityPub::ProcessCollectionService, call: nil))
|
||||
subject.perform(account.id, '')
|
||||
expect(ActivityPub::ProcessCollectionService).to have_received(:new)
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ describe Admin::DomainPurgeWorker do
|
|||
|
||||
describe 'perform' do
|
||||
it 'calls domain purge service for relevant domain block' do
|
||||
service = double(call: nil)
|
||||
service = instance_double(PurgeDomainService, call: nil)
|
||||
allow(PurgeDomainService).to receive(:new).and_return(service)
|
||||
result = subject.perform('example.com')
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ describe DomainBlockWorker do
|
|||
let(:domain_block) { Fabricate(:domain_block) }
|
||||
|
||||
it 'calls domain block service for relevant domain block' do
|
||||
service = double(call: nil)
|
||||
service = instance_double(BlockDomainService, call: nil)
|
||||
allow(BlockDomainService).to receive(:new).and_return(service)
|
||||
result = subject.perform(domain_block.id)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ describe DomainClearMediaWorker do
|
|||
let(:domain_block) { Fabricate(:domain_block, severity: :silence, reject_media: true) }
|
||||
|
||||
it 'calls domain clear media service for relevant domain block' do
|
||||
service = double(call: nil)
|
||||
service = instance_double(ClearDomainMediaService, call: nil)
|
||||
allow(ClearDomainMediaService).to receive(:new).and_return(service)
|
||||
result = subject.perform(domain_block.id)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ describe FeedInsertWorker do
|
|||
|
||||
context 'when there are no records' do
|
||||
it 'skips push with missing status' do
|
||||
instance = double(push_to_home: nil)
|
||||
instance = instance_double(FeedManager, push_to_home: nil)
|
||||
allow(FeedManager).to receive(:instance).and_return(instance)
|
||||
result = subject.perform(nil, follower.id)
|
||||
|
||||
|
@ -20,7 +20,7 @@ describe FeedInsertWorker do
|
|||
end
|
||||
|
||||
it 'skips push with missing account' do
|
||||
instance = double(push_to_home: nil)
|
||||
instance = instance_double(FeedManager, push_to_home: nil)
|
||||
allow(FeedManager).to receive(:instance).and_return(instance)
|
||||
result = subject.perform(status.id, nil)
|
||||
|
||||
|
@ -31,7 +31,7 @@ describe FeedInsertWorker do
|
|||
|
||||
context 'when there are real records' do
|
||||
it 'skips the push when there is a filter' do
|
||||
instance = double(push_to_home: nil, filter?: true)
|
||||
instance = instance_double(FeedManager, push_to_home: nil, filter?: true)
|
||||
allow(FeedManager).to receive(:instance).and_return(instance)
|
||||
result = subject.perform(status.id, follower.id)
|
||||
|
||||
|
@ -40,7 +40,7 @@ describe FeedInsertWorker do
|
|||
end
|
||||
|
||||
it 'pushes the status onto the home timeline without filter' do
|
||||
instance = double(push_to_home: nil, filter?: false)
|
||||
instance = instance_double(FeedManager, push_to_home: nil, filter?: false)
|
||||
allow(FeedManager).to receive(:instance).and_return(instance)
|
||||
result = subject.perform(status.id, follower.id)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ describe MoveWorker do
|
|||
let!(:account_note) { Fabricate(:account_note, account: local_user.account, target_account: source_account, comment: comment) }
|
||||
let(:list) { Fabricate(:list, account: local_follower) }
|
||||
|
||||
let(:block_service) { double }
|
||||
let(:block_service) { instance_double(BlockService) }
|
||||
|
||||
before do
|
||||
stub_request(:post, 'https://example.org/a/inbox').to_return(status: 200)
|
||||
|
|
|
@ -12,7 +12,7 @@ describe PublishScheduledAnnouncementWorker do
|
|||
|
||||
describe 'perform' do
|
||||
before do
|
||||
service = double
|
||||
service = instance_double(FetchRemoteStatusService)
|
||||
allow(FetchRemoteStatusService).to receive(:new).and_return(service)
|
||||
allow(service).to receive(:call).with('https://domain.com/users/foo/12345') { remote_status.reload }
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ describe RefollowWorker do
|
|||
let(:bob) { Fabricate(:account, domain: nil, username: 'bob') }
|
||||
|
||||
describe 'perform' do
|
||||
let(:service) { double }
|
||||
let(:service) { instance_double(FollowService) }
|
||||
|
||||
before do
|
||||
allow(FollowService).to receive(:new).and_return(service)
|
||||
|
|
|
@ -9,7 +9,7 @@ describe RegenerationWorker do
|
|||
let(:account) { Fabricate(:account) }
|
||||
|
||||
it 'calls the precompute feed service for the account' do
|
||||
service = double(call: nil)
|
||||
service = instance_double(PrecomputeFeedService, call: nil)
|
||||
allow(PrecomputeFeedService).to receive(:new).and_return(service)
|
||||
result = subject.perform(account.id)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue