Enable Rubocop RSpec/NotToNot (#23723)

This commit is contained in:
Nick Schonning 2023-02-19 20:33:27 -05:00 committed by GitHub
parent a2fdb388eb
commit 65ba0d92ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 94 additions and 214 deletions

View file

@ -63,7 +63,7 @@ describe AccountSearchService, type: :service do
allow(ResolveAccountService).to receive(:new).and_return(service)
results = subject.call('newuser@remote.com', nil, limit: 10, resolve: false)
expect(service).not_to have_received(:call)
expect(service).to_not have_received(:call)
end
end

View file

@ -39,7 +39,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
end
it 'does not process payload' do
expect(ActivityPub::Activity).not_to receive(:factory)
expect(ActivityPub::Activity).to_not receive(:factory)
subject.call(json, actor)
end
end
@ -69,7 +69,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
it 'does not process payload if no signature exists' do
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
expect(ActivityPub::Activity).not_to receive(:factory)
expect(ActivityPub::Activity).to_not receive(:factory)
subject.call(json, forwarder)
end
@ -87,7 +87,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
payload['signature'] = { 'type' => 'RsaSignature2017' }
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
expect(ActivityPub::Activity).not_to receive(:factory)
expect(ActivityPub::Activity).to_not receive(:factory)
subject.call(json, forwarder)
end
@ -206,7 +206,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
end
it 'does not process forged payload' do
expect(ActivityPub::Activity).not_to receive(:factory).with(
expect(ActivityPub::Activity).to_not receive(:factory).with(
hash_including(
'object' => hash_including(
'id' => 'https://example.com/users/bob/fake-status'
@ -216,7 +216,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
anything
)
expect(ActivityPub::Activity).not_to receive(:factory).with(
expect(ActivityPub::Activity).to_not receive(:factory).with(
hash_including(
'object' => hash_including(
'content' => '<p>puck was here</p>'

View file

@ -214,11 +214,11 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
it 'does not create any edits' do
expect { subject.call(status, json) }.not_to change { status.reload.edits.pluck(&:id) }
expect { subject.call(status, json) }.to_not change { status.reload.edits.pluck(&:id) }
end
it 'does not update the text, spoiler_text or edited_at' do
expect { subject.call(status, json) }.not_to change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
expect { subject.call(status, json) }.to_not change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
end
end

View file

@ -67,9 +67,9 @@ RSpec.describe BlockDomainService, type: :service do
end
it 'leaves the domains status and attachments, but clears media' do
expect { bad_status1.reload }.not_to raise_error
expect { bad_status2.reload }.not_to raise_error
expect { bad_attachment.reload }.not_to raise_error
expect { bad_status1.reload }.to_not raise_error
expect { bad_status2.reload }.to_not raise_error
expect { bad_attachment.reload }.to_not raise_error
expect(bad_attachment.file.exists?).to be false
end
end

View file

@ -14,9 +14,9 @@ RSpec.describe ClearDomainMediaService, type: :service do
end
it 'leaves the domains status and attachments, but clears media' do
expect { bad_status1.reload }.not_to raise_error
expect { bad_status2.reload }.not_to raise_error
expect { bad_attachment.reload }.not_to raise_error
expect { bad_status1.reload }.to_not raise_error
expect { bad_status2.reload }.to_not raise_error
expect { bad_attachment.reload }.to_not raise_error
expect(bad_attachment.file.exists?).to be false
end
end

View file

@ -234,7 +234,7 @@ RSpec.describe ImportService, type: :service do
subject.call(import)
expect(account.bookmarks.map(&:status).map(&:id)).to include(local_status.id)
expect(account.bookmarks.map(&:status).map(&:id)).to include(remote_status.id)
expect(account.bookmarks.map(&:status).map(&:id)).not_to include(direct_status.id)
expect(account.bookmarks.map(&:status).map(&:id)).to_not include(direct_status.id)
expect(account.bookmarks.count).to eq 3
end
end

View file

@ -50,7 +50,7 @@ RSpec.describe PostStatusService, type: :service do
end
it 'does not change statuses count' do
expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.not_to change { [account.statuses_count, previous_status.replies_count] }
expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.to_not change { [account.statuses_count, previous_status.replies_count] }
end
end
@ -157,7 +157,7 @@ RSpec.describe PostStatusService, type: :service do
expect do
subject.call(account, text: '@alice @alice @alice hey @alice')
end.not_to raise_error
end.to_not raise_error
end
it 'processes hashtags' do

View file

@ -13,8 +13,8 @@ describe SearchService, type: :service do
results = subject.call('', nil, 10)
expect(results).to eq(empty_results)
expect(AccountSearchService).not_to have_received(:new)
expect(Tag).not_to have_received(:search_for)
expect(AccountSearchService).to_not have_received(:new)
expect(Tag).to_not have_received(:search_for)
end
end
@ -89,7 +89,7 @@ describe SearchService, type: :service do
allow(Tag).to receive(:search_for)
results = subject.call(query, nil, 10)
expect(Tag).not_to have_received(:search_for)
expect(Tag).to_not have_received(:search_for)
expect(results).to eq empty_results
end