diff --git a/.rubocop.yml b/.rubocop.yml index 3783ccf48a..fc1969a645 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -94,6 +94,9 @@ Rails/Exit: - 'lib/mastodon/cli_helper.rb' - 'lib/cli.rb' +RSpec/NotToNot: + EnforcedStyle: to_not + Style/HashSyntax: EnforcedStyle: ruby19_no_mixed_keys diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 73ebdbfd81..9076891e2b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1440,129 +1440,6 @@ RSpec/NoExpectationExample: - 'spec/controllers/auth/registrations_controller_spec.rb' - 'spec/services/precompute_feed_service_spec.rb' -# Offense count: 370 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: not_to, to_not -RSpec/NotToNot: - Exclude: - - 'spec/config/initializers/rack_attack_spec.rb' - - 'spec/controllers/accounts_controller_spec.rb' - - 'spec/controllers/admin/accounts_controller_spec.rb' - - 'spec/controllers/admin/email_domain_blocks_controller_spec.rb' - - 'spec/controllers/admin/roles_controller_spec.rb' - - 'spec/controllers/api/v1/accounts_controller_spec.rb' - - 'spec/controllers/api/v1/admin/account_actions_controller_spec.rb' - - 'spec/controllers/api/v1/admin/accounts_controller_spec.rb' - - 'spec/controllers/api/v1/admin/domain_allows_controller_spec.rb' - - 'spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb' - - 'spec/controllers/api/v1/announcements/reactions_controller_spec.rb' - - 'spec/controllers/api/v1/announcements_controller_spec.rb' - - 'spec/controllers/api/v1/apps/credentials_controller_spec.rb' - - 'spec/controllers/api/v1/apps_controller_spec.rb' - - 'spec/controllers/api/v1/filters_controller_spec.rb' - - 'spec/controllers/api/v1/media_controller_spec.rb' - - 'spec/controllers/api/v1/notifications_controller_spec.rb' - - 'spec/controllers/api/v1/polls/votes_controller_spec.rb' - - 'spec/controllers/api/v1/reports_controller_spec.rb' - - 'spec/controllers/api/v1/statuses/mutes_controller_spec.rb' - - 'spec/controllers/api/v2/filters/keywords_controller_spec.rb' - - 'spec/controllers/api/v2/filters/statuses_controller_spec.rb' - - 'spec/controllers/api/v2/filters_controller_spec.rb' - - 'spec/controllers/auth/challenges_controller_spec.rb' - - 'spec/controllers/auth/confirmations_controller_spec.rb' - - 'spec/controllers/auth/passwords_controller_spec.rb' - - 'spec/controllers/auth/registrations_controller_spec.rb' - - 'spec/controllers/concerns/challengable_concern_spec.rb' - - 'spec/controllers/oauth/authorized_applications_controller_spec.rb' - - 'spec/controllers/oauth/tokens_controller_spec.rb' - - 'spec/controllers/settings/applications_controller_spec.rb' - - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' - - 'spec/controllers/statuses_controller_spec.rb' - - 'spec/helpers/application_helper_spec.rb' - - 'spec/lib/activitypub/activity/announce_spec.rb' - - 'spec/lib/activitypub/activity/create_spec.rb' - - 'spec/lib/activitypub/activity/delete_spec.rb' - - 'spec/lib/activitypub/activity/flag_spec.rb' - - 'spec/lib/activitypub/dereferencer_spec.rb' - - 'spec/lib/activitypub/tag_manager_spec.rb' - - 'spec/lib/delivery_failure_tracker_spec.rb' - - 'spec/lib/feed_manager_spec.rb' - - 'spec/lib/html_aware_formatter_spec.rb' - - 'spec/lib/request_pool_spec.rb' - - 'spec/lib/status_reach_finder_spec.rb' - - 'spec/lib/vacuum/access_tokens_vacuum_spec.rb' - - 'spec/lib/vacuum/backups_vacuum_spec.rb' - - 'spec/lib/vacuum/media_attachments_vacuum_spec.rb' - - 'spec/lib/vacuum/preview_cards_vacuum_spec.rb' - - 'spec/lib/vacuum/statuses_vacuum_spec.rb' - - 'spec/lib/vacuum/system_keys_vacuum_spec.rb' - - 'spec/models/account/field_spec.rb' - - 'spec/models/account_conversation_spec.rb' - - 'spec/models/account_spec.rb' - - 'spec/models/account_statuses_cleanup_policy_spec.rb' - - 'spec/models/account_statuses_filter_spec.rb' - - 'spec/models/concerns/remotable_spec.rb' - - 'spec/models/concerns/status_threading_concern_spec.rb' - - 'spec/models/follow_spec.rb' - - 'spec/models/media_attachment_spec.rb' - - 'spec/models/status_spec.rb' - - 'spec/models/tag_feed_spec.rb' - - 'spec/models/trends/statuses_spec.rb' - - 'spec/models/trends/tags_spec.rb' - - 'spec/models/user_spec.rb' - - 'spec/models/webhook_spec.rb' - - 'spec/policies/account_moderation_note_policy_spec.rb' - - 'spec/policies/account_policy_spec.rb' - - 'spec/policies/backup_policy_spec.rb' - - 'spec/policies/custom_emoji_policy_spec.rb' - - 'spec/policies/domain_block_policy_spec.rb' - - 'spec/policies/email_domain_block_policy_spec.rb' - - 'spec/policies/instance_policy_spec.rb' - - 'spec/policies/invite_policy_spec.rb' - - 'spec/policies/relay_policy_spec.rb' - - 'spec/policies/report_note_policy_spec.rb' - - 'spec/policies/report_policy_spec.rb' - - 'spec/policies/settings_policy_spec.rb' - - 'spec/policies/status_policy_spec.rb' - - 'spec/policies/tag_policy_spec.rb' - - 'spec/policies/user_policy_spec.rb' - - 'spec/presenters/familiar_followers_presenter_spec.rb' - - 'spec/serializers/activitypub/note_spec.rb' - - 'spec/services/account_statuses_cleanup_service_spec.rb' - - 'spec/services/activitypub/fetch_remote_status_service_spec.rb' - - 'spec/services/activitypub/process_account_service_spec.rb' - - 'spec/services/activitypub/process_status_update_service_spec.rb' - - 'spec/services/app_sign_up_service_spec.rb' - - 'spec/services/batched_remove_status_service_spec.rb' - - 'spec/services/block_domain_service_spec.rb' - - 'spec/services/bootstrap_timeline_service_spec.rb' - - 'spec/services/fan_out_on_write_service_spec.rb' - - 'spec/services/favourite_service_spec.rb' - - 'spec/services/fetch_link_card_service_spec.rb' - - 'spec/services/fetch_oembed_service_spec.rb' - - 'spec/services/fetch_remote_status_service_spec.rb' - - 'spec/services/follow_service_spec.rb' - - 'spec/services/mute_service_spec.rb' - - 'spec/services/notify_service_spec.rb' - - 'spec/services/remove_status_service_spec.rb' - - 'spec/services/report_service_spec.rb' - - 'spec/services/resolve_account_service_spec.rb' - - 'spec/services/search_service_spec.rb' - - 'spec/services/suspend_account_service_spec.rb' - - 'spec/services/unallow_domain_service_spec.rb' - - 'spec/services/unsuspend_account_service_spec.rb' - - 'spec/services/update_status_service_spec.rb' - - 'spec/support/examples/models/concerns/account_avatar.rb' - - 'spec/support/examples/models/concerns/account_header.rb' - - 'spec/validators/email_mx_validator_spec.rb' - - 'spec/validators/note_length_validator_spec.rb' - - 'spec/validators/reaction_validator_spec.rb' - - 'spec/validators/status_length_validator_spec.rb' - - 'spec/validators/unique_username_validator_spec.rb' - - 'spec/workers/activitypub/fetch_replies_worker_spec.rb' - - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' - # Offense count: 3 RSpec/PendingWithoutReason: Exclude: diff --git a/spec/controllers/activitypub/collections_controller_spec.rb b/spec/controllers/activitypub/collections_controller_spec.rb index 4e35938dba..bf81cdb93c 100644 --- a/spec/controllers/activitypub/collections_controller_spec.rb +++ b/spec/controllers/activitypub/collections_controller_spec.rb @@ -60,7 +60,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do end it 'does not include contents of private pinned status' do - expect(response.body).not_to include(private_pinned.text) + expect(response.body).to_not include(private_pinned.text) end context 'when account is permanently suspended' do @@ -115,7 +115,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do end it 'does not include contents of private pinned status' do - expect(response.body).not_to include(private_pinned.text) + expect(response.body).to_not include(private_pinned.text) end end diff --git a/spec/controllers/activitypub/inboxes_controller_spec.rb b/spec/controllers/activitypub/inboxes_controller_spec.rb index 2f023197be..7f4d6b2d3e 100644 --- a/spec/controllers/activitypub/inboxes_controller_spec.rb +++ b/spec/controllers/activitypub/inboxes_controller_spec.rb @@ -68,7 +68,7 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do let(:synchronization_collection) { 'https://example.com/followers2' } it 'does not start a synchronization job' do - expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async) + expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async) end end @@ -76,13 +76,13 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do let(:synchronization_url) { 'https://example.org/followers' } it 'does not start a synchronization job' do - expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async) + expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async) end end context 'with matching digest' do it 'does not start a synchronization job' do - expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async) + expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async) end end diff --git a/spec/controllers/admin/account_moderation_notes_controller_spec.rb b/spec/controllers/admin/account_moderation_notes_controller_spec.rb index d3f3263f88..b8d6063227 100644 --- a/spec/controllers/admin/account_moderation_notes_controller_spec.rb +++ b/spec/controllers/admin/account_moderation_notes_controller_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Admin::AccountModerationNotesController, type: :controller do let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: '' } } } it 'falls to create a note' do - expect { subject }.not_to change { AccountModerationNote.count } + expect { subject }.to_not change { AccountModerationNote.count } expect(subject).to render_template 'admin/accounts/show' end end diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index 48204b7b6e..35d79740ac 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -84,7 +84,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to memorialize account' do is_expected.to have_http_status :forbidden - expect(account.reload).not_to be_memorial + expect(account.reload).to_not be_memorial end end @@ -106,7 +106,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to memorialize account' do is_expected.to have_http_status :forbidden - expect(account.reload).not_to be_memorial + expect(account.reload).to_not be_memorial end end @@ -115,7 +115,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to memorialize account' do is_expected.to have_http_status :forbidden - expect(account.reload).not_to be_memorial + expect(account.reload).to_not be_memorial end end end @@ -133,7 +133,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'succeeds in enabling account' do is_expected.to redirect_to admin_account_path(account.id) - expect(user.reload).not_to be_disabled + expect(user.reload).to_not be_disabled end end @@ -183,7 +183,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to approve account' do is_expected.to have_http_status :forbidden - expect(user.reload).not_to be_approved + expect(user.reload).to_not be_approved end end end @@ -223,7 +223,7 @@ RSpec.describe Admin::AccountsController, type: :controller do it 'fails to reject account' do is_expected.to have_http_status :forbidden - expect(user.reload).not_to be_approved + expect(user.reload).to_not be_approved end end end diff --git a/spec/controllers/admin/change_email_controller_spec.rb b/spec/controllers/admin/change_email_controller_spec.rb index 0814f327d8..520842a19f 100644 --- a/spec/controllers/admin/change_email_controller_spec.rb +++ b/spec/controllers/admin/change_email_controller_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do expect(user.email).to eq previous_email expect(user.unconfirmed_email).to eq 'test@example.com' - expect(user.confirmation_token).not_to be_nil + expect(user.confirmation_token).to_not be_nil expect(UserMailer).to have_received(:confirmation_instructions).with(user, user.confirmation_token, { to: 'test@example.com' }) diff --git a/spec/controllers/admin/confirmations_controller_spec.rb b/spec/controllers/admin/confirmations_controller_spec.rb index 6268903c4e..7ca90f3e12 100644 --- a/spec/controllers/admin/confirmations_controller_spec.rb +++ b/spec/controllers/admin/confirmations_controller_spec.rb @@ -55,7 +55,7 @@ RSpec.describe Admin::ConfirmationsController, type: :controller do it 'does not resend confirmation mail' do expect(subject).to redirect_to admin_accounts_path expect(flash[:error]).to eq I18n.t('admin.accounts.resend_confirmation.already_confirmed') - expect(UserMailer).not_to have_received(:confirmation_instructions) + expect(UserMailer).to_not have_received(:confirmation_instructions) end end end diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb index 3b2fd6c5dc..92fc19efac 100644 --- a/spec/controllers/admin/domain_blocks_controller_spec.rb +++ b/spec/controllers/admin/domain_blocks_controller_spec.rb @@ -54,7 +54,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do post :create, params: { domain_block: { domain: 'example.com', severity: 'silence' } } - expect(DomainBlockWorker).not_to have_received(:perform_async) + expect(DomainBlockWorker).to_not have_received(:perform_async) expect(response).to render_template :new end diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb index fa7572d186..8a2603611c 100644 --- a/spec/controllers/admin/report_notes_controller_spec.rb +++ b/spec/controllers/admin/report_notes_controller_spec.rb @@ -34,7 +34,7 @@ describe Admin::ReportNotesController do it 'creates a report note and does not resolve report' do expect { subject }.to change { ReportNote.count }.by(1) - expect(report.reload).not_to be_action_taken + expect(report.reload).to_not be_action_taken expect(subject).to redirect_to admin_report_path(report) end end @@ -49,7 +49,7 @@ describe Admin::ReportNotesController do it 'creates a report note and unresolves report' do expect { subject }.to change { ReportNote.count }.by(1) - expect(report.reload).not_to be_action_taken + expect(report.reload).to_not be_action_taken expect(subject).to redirect_to admin_report_path(report) end end diff --git a/spec/controllers/settings/profiles_controller_spec.rb b/spec/controllers/settings/profiles_controller_spec.rb index fbbca8bb92..c7a6ad6643 100644 --- a/spec/controllers/settings/profiles_controller_spec.rb +++ b/spec/controllers/settings/profiles_controller_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Settings::ProfilesController, type: :controller do put :update, params: { account: { avatar: fixture_file_upload('avatar.gif', 'image/gif') } } expect(response).to redirect_to(settings_profile_path) - expect(account.reload.avatar.instance.avatar_file_name).not_to be_nil + expect(account.reload.avatar.instance.avatar_file_name).to_not be_nil expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id) end end diff --git a/spec/controllers/well_known/nodeinfo_controller_spec.rb b/spec/controllers/well_known/nodeinfo_controller_spec.rb index 964a14706b..e9436cd262 100644 --- a/spec/controllers/well_known/nodeinfo_controller_spec.rb +++ b/spec/controllers/well_known/nodeinfo_controller_spec.rb @@ -27,7 +27,7 @@ describe WellKnown::NodeInfoController, type: :controller do json = body_as_json - expect({ 'foo' => 0 }).not_to match_json_schema('nodeinfo_2.0') + expect({ 'foo' => 0 }).to_not match_json_schema('nodeinfo_2.0') expect(json).to match_json_schema('nodeinfo_2.0') expect(json[:version]).to eq '2.0' expect(json[:usage]).to be_a Hash diff --git a/spec/lib/activitypub/activity/announce_spec.rb b/spec/lib/activitypub/activity/announce_spec.rb index 461c3757b3..adb13acc21 100644 --- a/spec/lib/activitypub/activity/announce_spec.rb +++ b/spec/lib/activitypub/activity/announce_spec.rb @@ -139,7 +139,7 @@ RSpec.describe ActivityPub::Activity::Announce do end it 'does not fetch the remote status' do - expect(a_request(:get, 'https://example.com/actor/hello-world')).not_to have_been_made + expect(a_request(:get, 'https://example.com/actor/hello-world')).to_not have_been_made expect(Status.find_by(uri: 'https://example.com/actor/hello-world')).to be_nil end diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb index e555a8b5a1..f63a836de4 100644 --- a/spec/lib/request_spec.rb +++ b/spec/lib/request_spec.rb @@ -102,7 +102,7 @@ describe Request do it 'accepts body less than 1 megabyte by default' do stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.kilobytes)) - expect { subject.perform { |response| response.body_with_limit } }.not_to raise_error + expect { subject.perform { |response| response.body_with_limit } }.to_not raise_error end it 'rejects body by given size' do diff --git a/spec/lib/status_filter_spec.rb b/spec/lib/status_filter_spec.rb index 287fe00de6..cdb4820590 100644 --- a/spec/lib/status_filter_spec.rb +++ b/spec/lib/status_filter_spec.rb @@ -10,7 +10,7 @@ describe StatusFilter do subject { described_class.new(status, nil) } context 'when there are no connections' do - it { is_expected.not_to be_filtered } + it { is_expected.to_not be_filtered } end context 'when status account is silenced' do @@ -36,7 +36,7 @@ describe StatusFilter do subject { described_class.new(status, account) } context 'when there are no connections' do - it { is_expected.not_to be_filtered } + it { is_expected.to_not be_filtered } end context 'when status account is blocked' do diff --git a/spec/lib/text_formatter_spec.rb b/spec/lib/text_formatter_spec.rb index d4a3a6b594..cc742b65e6 100644 --- a/spec/lib/text_formatter_spec.rb +++ b/spec/lib/text_formatter_spec.rb @@ -18,7 +18,7 @@ RSpec.describe TextFormatter do let(:text) { "line\nfeed" } it 'removes line feeds' do - is_expected.not_to include "\n" + is_expected.to_not include "\n" end end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 7638356181..03ed12d780 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -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 diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb index b79c445948..b2d84308b5 100644 --- a/spec/models/concerns/account_interactions_spec.rb +++ b/spec/models/concerns/account_interactions_spec.rb @@ -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 diff --git a/spec/models/concerns/remotable_spec.rb b/spec/models/concerns/remotable_spec.rb index ca2d65d2d1..9645204276 100644 --- a/spec/models/concerns/remotable_spec.rb +++ b/spec/models/concerns/remotable_spec.rb @@ -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 diff --git a/spec/models/public_feed_spec.rb b/spec/models/public_feed_spec.rb index 0ffc343f17..be46639c52 100644 --- a/spec/models/public_feed_spec.rb +++ b/spec/models/public_feed_spec.rb @@ -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 diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index 83ba415a81..0772230943 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -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 diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 102d2f6251..7043449c5e 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -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 aesthetic' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index dde1503c0d..c2f7e99ac6 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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 diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb index d3b5baad62..45e19d1ef7 100644 --- a/spec/services/account_search_service_spec.rb +++ b/spec/services/account_search_service_spec.rb @@ -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 diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index fbfa6d6c6b..d35d9596df 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -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' => '

puck was here

' diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb index 5d15f6ffeb..ae7db88bf1 100644 --- a/spec/services/activitypub/process_status_update_service_spec.rb +++ b/spec/services/activitypub/process_status_update_service_spec.rb @@ -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 diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb index 242b02fff7..e24e48d415 100644 --- a/spec/services/block_domain_service_spec.rb +++ b/spec/services/block_domain_service_spec.rb @@ -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 diff --git a/spec/services/clear_domain_media_service_spec.rb b/spec/services/clear_domain_media_service_spec.rb index 45b92e2c94..e90faf84d9 100644 --- a/spec/services/clear_domain_media_service_spec.rb +++ b/spec/services/clear_domain_media_service_spec.rb @@ -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 diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb index a12148833d..2b1516ff08 100644 --- a/spec/services/import_service_spec.rb +++ b/spec/services/import_service_spec.rb @@ -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 diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 0b72253a5a..2148f18197 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -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 diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb index 6f32007e83..7ec334a56c 100644 --- a/spec/services/search_service_spec.rb +++ b/spec/services/search_service_spec.rb @@ -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 diff --git a/spec/validators/blacklisted_email_validator_spec.rb b/spec/validators/blacklisted_email_validator_spec.rb index f9ee3b932a..cb807fe24c 100644 --- a/spec/validators/blacklisted_email_validator_spec.rb +++ b/spec/validators/blacklisted_email_validator_spec.rb @@ -26,7 +26,7 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do let(:blocked_email) { false } it 'does not add errors' do - expect(subject).not_to have_received(:add).with(:email, :blocked) + expect(subject).to_not have_received(:add).with(:email, :blocked) end context 'when canonical e-mail is blocked' do diff --git a/spec/validators/disallowed_hashtags_validator_spec.rb b/spec/validators/disallowed_hashtags_validator_spec.rb index 9deec0bb90..2c4ebc4f25 100644 --- a/spec/validators/disallowed_hashtags_validator_spec.rb +++ b/spec/validators/disallowed_hashtags_validator_spec.rb @@ -19,7 +19,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do let(:reblog) { true } it 'does not add errors' do - expect(errors).not_to have_received(:add).with(:text, any_args) + expect(errors).to_not have_received(:add).with(:text, any_args) end end @@ -31,7 +31,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do let(:disallowed_tags) { [] } it 'does not add errors' do - expect(errors).not_to have_received(:add).with(:text, any_args) + expect(errors).to_not have_received(:add).with(:text, any_args) end end diff --git a/spec/validators/email_mx_validator_spec.rb b/spec/validators/email_mx_validator_spec.rb index 6640d6058e..ffb6851d09 100644 --- a/spec/validators/email_mx_validator_spec.rb +++ b/spec/validators/email_mx_validator_spec.rb @@ -38,7 +38,7 @@ describe EmailMxValidator do allow(Resolv::DNS).to receive(:open).and_yield(resolver) subject.validate(user) - expect(user.errors).not_to have_received(:add) + expect(user.errors).to_not have_received(:add) end it 'adds an error if the email domain name contains empty labels' do diff --git a/spec/validators/follow_limit_validator_spec.rb b/spec/validators/follow_limit_validator_spec.rb index cc8fbb6313..94ba0c47f8 100644 --- a/spec/validators/follow_limit_validator_spec.rb +++ b/spec/validators/follow_limit_validator_spec.rb @@ -22,7 +22,7 @@ RSpec.describe FollowLimitValidator, type: :validator do let(:_nil) { true } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:base, any_args) + expect(errors).to_not have_received(:add).with(:base, any_args) end end @@ -43,7 +43,7 @@ RSpec.describe FollowLimitValidator, type: :validator do let(:limit_reached) { false } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:base, any_args) + expect(errors).to_not have_received(:add).with(:base, any_args) end end end diff --git a/spec/validators/poll_validator_spec.rb b/spec/validators/poll_validator_spec.rb index a76c63ccc2..f3f4b12881 100644 --- a/spec/validators/poll_validator_spec.rb +++ b/spec/validators/poll_validator_spec.rb @@ -15,14 +15,14 @@ RSpec.describe PollValidator, type: :validator do let(:expires_at) { 1.day.from_now } it 'have no errors' do - expect(errors).not_to have_received(:add) + expect(errors).to_not have_received(:add) end context 'expires just 5 min ago' do let(:expires_at) { 5.minutes.from_now } it 'not calls errors add' do - expect(errors).not_to have_received(:add) + expect(errors).to_not have_received(:add) end end end diff --git a/spec/validators/status_length_validator_spec.rb b/spec/validators/status_length_validator_spec.rb index db9c728a8b..e132b5618a 100644 --- a/spec/validators/status_length_validator_spec.rb +++ b/spec/validators/status_length_validator_spec.rb @@ -7,13 +7,13 @@ describe StatusLengthValidator do it 'does not add errors onto remote statuses' do status = double(local?: false) subject.validate(status) - expect(status).not_to receive(:errors) + expect(status).to_not receive(:errors) end it 'does not add errors onto local reblogs' do status = double(local?: false, reblog?: true) subject.validate(status) - expect(status).not_to receive(:errors) + expect(status).to_not receive(:errors) end it 'adds an error when content warning is over 500 characters' do diff --git a/spec/validators/unreserved_username_validator_spec.rb b/spec/validators/unreserved_username_validator_spec.rb index e2f051b086..3c6f71c590 100644 --- a/spec/validators/unreserved_username_validator_spec.rb +++ b/spec/validators/unreserved_username_validator_spec.rb @@ -17,7 +17,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do let(:username) { nil } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:username, any_args) + expect(errors).to_not have_received(:add).with(:username, any_args) end end @@ -36,7 +36,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do let(:reserved_username) { false } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(:username, any_args) + expect(errors).to_not have_received(:add).with(:username, any_args) end end end diff --git a/spec/validators/url_validator_spec.rb b/spec/validators/url_validator_spec.rb index 85eadeb63a..966261b505 100644 --- a/spec/validators/url_validator_spec.rb +++ b/spec/validators/url_validator_spec.rb @@ -27,7 +27,7 @@ RSpec.describe URLValidator, type: :validator do let(:compliant) { true } it 'not calls errors.add' do - expect(errors).not_to have_received(:add).with(attribute, any_args) + expect(errors).to_not have_received(:add).with(attribute, any_args) end end end diff --git a/spec/workers/feed_insert_worker_spec.rb b/spec/workers/feed_insert_worker_spec.rb index fb34970fc3..1a723d63a1 100644 --- a/spec/workers/feed_insert_worker_spec.rb +++ b/spec/workers/feed_insert_worker_spec.rb @@ -16,7 +16,7 @@ describe FeedInsertWorker do result = subject.perform(nil, follower.id) expect(result).to eq true - expect(instance).not_to have_received(:push_to_home) + expect(instance).to_not have_received(:push_to_home) end it 'skips push with missing account' do @@ -25,7 +25,7 @@ describe FeedInsertWorker do result = subject.perform(status.id, nil) expect(result).to eq true - expect(instance).not_to have_received(:push_to_home) + expect(instance).to_not have_received(:push_to_home) end end @@ -36,7 +36,7 @@ describe FeedInsertWorker do result = subject.perform(status.id, follower.id) expect(result).to be_nil - expect(instance).not_to have_received(:push_to_home) + expect(instance).to_not have_received(:push_to_home) end it 'pushes the status onto the home timeline without filter' do