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
40 changed files with 94 additions and 214 deletions

View File

@ -31,7 +31,7 @@ RSpec.describe Account, type: :model do
end
it 'does not raise an error' do
expect { subject.suspend! }.not_to raise_error
expect { subject.suspend! }.to_not raise_error
end
end
end
@ -206,7 +206,7 @@ RSpec.describe Account, type: :model do
end
it 'calls not ResolveAccountService#call' do
expect_any_instance_of(ResolveAccountService).not_to receive(:call).with(acct)
expect_any_instance_of(ResolveAccountService).to_not receive(:call).with(acct)
account.refresh!
end
end
@ -811,19 +811,19 @@ RSpec.describe Account, type: :model do
it 'is valid even if the username is longer than 30 characters' do
account = Fabricate.build(:account, domain: 'domain', username: Faker::Lorem.characters(number: 31))
account.valid?
expect(account).not_to model_have_error_on_field(:username)
expect(account).to_not model_have_error_on_field(:username)
end
it 'is valid even if the display name is longer than 30 characters' do
account = Fabricate.build(:account, domain: 'domain', display_name: Faker::Lorem.characters(number: 31))
account.valid?
expect(account).not_to model_have_error_on_field(:display_name)
expect(account).to_not model_have_error_on_field(:display_name)
end
it 'is valid even if the note is longer than 500 characters' do
account = Fabricate.build(:account, domain: 'domain', note: Faker::Lorem.characters(number: 501))
account.valid?
expect(account).not_to model_have_error_on_field(:note)
expect(account).to_not model_have_error_on_field(:note)
end
end
end

View File

@ -163,7 +163,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(true)
end.to_not change { mute.reload.hide_notifications? }.from(true)
end
end
@ -183,7 +183,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(true)
end.to_not change { mute.reload.hide_notifications? }.from(true)
end
end
end
@ -207,7 +207,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(false)
end.to_not change { mute.reload.hide_notifications? }.from(false)
end
end

View File

@ -147,8 +147,8 @@ RSpec.describe Remotable do
let(:code) { 500 }
it 'does not assign file' do
expect(foo).not_to receive(:public_send).with("#{hoge}=", any_args)
expect(foo).not_to receive(:public_send).with("#{hoge}_file_name=", any_args)
expect(foo).to_not receive(:public_send).with("#{hoge}=", any_args)
expect(foo).to_not receive(:public_send).with("#{hoge}_file_name=", any_args)
foo.hoge_remote_url = url
end

View File

@ -11,7 +11,7 @@ RSpec.describe PublicFeed, type: :model do
private_status = Fabricate(:status, visibility: :private)
expect(subject).to include(public_status.id)
expect(subject).not_to include(private_status.id)
expect(subject).to_not include(private_status.id)
end
it 'does not include replies' do
@ -19,7 +19,7 @@ RSpec.describe PublicFeed, type: :model do
reply = Fabricate(:status, in_reply_to_id: status.id)
expect(subject).to include(status.id)
expect(subject).not_to include(reply.id)
expect(subject).to_not include(reply.id)
end
it 'does not include boosts' do
@ -27,7 +27,7 @@ RSpec.describe PublicFeed, type: :model do
boost = Fabricate(:status, reblog_of_id: status.id)
expect(subject).to include(status.id)
expect(subject).not_to include(boost.id)
expect(subject).to_not include(boost.id)
end
it 'filters out silenced accounts' do
@ -36,7 +36,7 @@ RSpec.describe PublicFeed, type: :model do
silenced_status = Fabricate(:status, account: silenced_account)
expect(subject).to include(status.id)
expect(subject).not_to include(silenced_status.id)
expect(subject).to_not include(silenced_status.id)
end
context 'without local_only option' do
@ -87,7 +87,7 @@ RSpec.describe PublicFeed, type: :model do
it 'does not include remote instances statuses' do
expect(subject).to include(local_status.id)
expect(subject).not_to include(remote_status.id)
expect(subject).to_not include(remote_status.id)
end
end
@ -96,13 +96,13 @@ RSpec.describe PublicFeed, type: :model do
it 'does not include remote instances statuses' do
expect(subject).to include(local_status.id)
expect(subject).not_to include(remote_status.id)
expect(subject).to_not include(remote_status.id)
end
it 'is not affected by personal domain blocks' do
viewer.block_domain!('test.com')
expect(subject).to include(local_status.id)
expect(subject).not_to include(remote_status.id)
expect(subject).to_not include(remote_status.id)
end
end
end
@ -119,7 +119,7 @@ RSpec.describe PublicFeed, type: :model do
let(:viewer) { nil }
it 'does not include local instances statuses' do
expect(subject).not_to include(local_status.id)
expect(subject).to_not include(local_status.id)
expect(subject).to include(remote_status.id)
end
end
@ -128,7 +128,7 @@ RSpec.describe PublicFeed, type: :model do
let(:viewer) { Fabricate(:account, username: 'viewer') }
it 'does not include local instances statuses' do
expect(subject).not_to include(local_status.id)
expect(subject).to_not include(local_status.id)
expect(subject).to include(remote_status.id)
end
end
@ -146,7 +146,7 @@ RSpec.describe PublicFeed, type: :model do
@account.block!(blocked)
blocked_status = Fabricate(:status, account: blocked)
expect(subject).not_to include(blocked_status.id)
expect(subject).to_not include(blocked_status.id)
end
it 'excludes statuses from accounts who have blocked the account' do
@ -154,7 +154,7 @@ RSpec.describe PublicFeed, type: :model do
blocker.block!(@account)
blocked_status = Fabricate(:status, account: blocker)
expect(subject).not_to include(blocked_status.id)
expect(subject).to_not include(blocked_status.id)
end
it 'excludes statuses from accounts muted by the account' do
@ -162,7 +162,7 @@ RSpec.describe PublicFeed, type: :model do
@account.mute!(muted)
muted_status = Fabricate(:status, account: muted)
expect(subject).not_to include(muted_status.id)
expect(subject).to_not include(muted_status.id)
end
it 'excludes statuses from accounts from personally blocked domains' do
@ -170,7 +170,7 @@ RSpec.describe PublicFeed, type: :model do
@account.block_domain!(blocked.domain)
blocked_status = Fabricate(:status, account: blocked)
expect(subject).not_to include(blocked_status.id)
expect(subject).to_not include(blocked_status.id)
end
context 'with language preferences' do
@ -182,7 +182,7 @@ RSpec.describe PublicFeed, type: :model do
expect(subject).to include(en_status.id)
expect(subject).to include(es_status.id)
expect(subject).not_to include(fr_status.id)
expect(subject).to_not include(fr_status.id)
end
it 'includes all languages when user does not have a setting' do

View File

@ -38,7 +38,7 @@ RSpec.describe Setting, type: :model do
let(:cache_value) { 'cache-value' }
it 'calls not RailsSettings::Base#[]' do
expect(RailsSettings::Base).not_to receive(:[]).with(key)
expect(RailsSettings::Base).to_not receive(:[]).with(key)
described_class[key]
end
@ -104,7 +104,7 @@ RSpec.describe Setting, type: :model do
ActiveSupport::Notifications.subscribed callback, 'sql.active_record' do
described_class[key]
end
expect(callback).not_to have_received(:call)
expect(callback).to_not have_received(:call)
end
it 'returns the cached value' do

View File

@ -4,15 +4,15 @@ require 'rails_helper'
RSpec.describe Tag do
describe 'validations' do
it 'invalid with #' do
expect(described_class.new(name: '#hello_world')).not_to be_valid
expect(described_class.new(name: '#hello_world')).to_not be_valid
end
it 'invalid with .' do
expect(described_class.new(name: '.abcdef123')).not_to be_valid
expect(described_class.new(name: '.abcdef123')).to_not be_valid
end
it 'invalid with spaces' do
expect(described_class.new(name: 'hello world')).not_to be_valid
expect(described_class.new(name: 'hello world')).to_not be_valid
end
it 'valid with ' do

View File

@ -159,7 +159,7 @@ RSpec.describe User, type: :model do
it 'does not trigger the account.approved Web Hook' do
subject
expect(TriggerWebhookWorker).not_to have_received(:perform_async).with('account.approved', 'Account', user.account_id)
expect(TriggerWebhookWorker).to_not have_received(:perform_async).with('account.approved', 'Account', user.account_id)
end
end
@ -270,7 +270,7 @@ RSpec.describe User, type: :model do
it 'does not trigger the account.approved Web Hook' do
subject
expect(TriggerWebhookWorker).not_to have_received(:perform_async).with('account.approved', 'Account', user.account_id)
expect(TriggerWebhookWorker).to_not have_received(:perform_async).with('account.approved', 'Account', user.account_id)
end
end
end