From 38a1d8bb85da6c7a52a3bde28af368b8d2104d02 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sun, 19 Feb 2023 23:00:48 -0500 Subject: [PATCH] Autofix Rubocop RSpec/ImplicitSubject (#23721) --- .rubocop_todo.yml | 86 ++++++------------- app/serializers/initial_state_serializer.rb | 1 - .../admin/accounts_controller_spec.rb | 32 +++---- .../admin/instances_controller_spec.rb | 4 +- .../application_controller_spec.rb | 2 +- spec/controllers/home_controller_spec.rb | 4 +- .../relationships_controller_spec.rb | 2 +- .../settings/featured_tags_controller_spec.rb | 2 +- .../settings/migrations_controller_spec.rb | 18 ++-- .../settings/sessions_controller_spec.rb | 4 +- spec/features/log_in_spec.rb | 6 +- spec/features/profile_spec.rb | 4 +- spec/lib/emoji_formatter_spec.rb | 8 +- spec/lib/entity_cache_spec.rb | 2 +- spec/lib/html_aware_formatter_spec.rb | 8 +- spec/lib/ostatus/tag_manager_spec.rb | 6 +- spec/lib/plain_text_formatter_spec.rb | 4 +- spec/lib/text_formatter_spec.rb | 78 ++++++++--------- .../concerns/account_interactions_spec.rb | 86 +++++++++---------- spec/models/custom_emoji_spec.rb | 12 +-- spec/models/media_attachment_spec.rb | 10 +-- spec/models/notification_spec.rb | 2 +- spec/models/remote_follow_spec.rb | 10 +-- spec/models/report_spec.rb | 4 +- spec/models/session_activation_spec.rb | 6 +- spec/models/setting_spec.rb | 4 +- 26 files changed, 184 insertions(+), 221 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7cb4d55e0..4c3b3ecb6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2023-02-16 05:53:07 UTC using RuboCop version 1.45.1. +# on 2023-02-19 06:22:09 UTC using RuboCop version 1.45.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -162,7 +162,7 @@ Layout/HashAlignment: - 'spec/models/admin/account_action_spec.rb' - 'spec/models/concerns/account_interactions_spec.rb' -# Offense count: 577 +# Offense count: 581 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https @@ -305,18 +305,17 @@ Lint/Void: Exclude: - 'spec/services/resolve_account_service_spec.rb' -# Offense count: 65 +# Offense count: 66 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Enabled: false -# Offense count: 11 +# Offense count: 10 # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine Metrics/BlockLength: Exclude: - 'app/models/concerns/account_interactions.rb' - - 'app/models/concerns/omniauthable.rb' - 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' - 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' - 'lib/tasks/branding.rake' @@ -335,7 +334,7 @@ Metrics/BlockNesting: Metrics/CyclomaticComplexity: Enabled: false -# Offense count: 40 +# Offense count: 35 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Enabled: false @@ -936,37 +935,6 @@ RSpec/HookArgument: - 'spec/services/import_service_spec.rb' - 'spec/spec_helper.rb' -# Offense count: 159 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit -RSpec/ImplicitSubject: - Exclude: - - 'spec/controllers/admin/accounts_controller_spec.rb' - - 'spec/controllers/admin/instances_controller_spec.rb' - - 'spec/controllers/application_controller_spec.rb' - - 'spec/controllers/home_controller_spec.rb' - - 'spec/controllers/relationships_controller_spec.rb' - - 'spec/controllers/settings/featured_tags_controller_spec.rb' - - 'spec/controllers/settings/migrations_controller_spec.rb' - - 'spec/controllers/settings/sessions_controller_spec.rb' - - 'spec/features/log_in_spec.rb' - - 'spec/features/profile_spec.rb' - - 'spec/lib/emoji_formatter_spec.rb' - - 'spec/lib/entity_cache_spec.rb' - - 'spec/lib/html_aware_formatter_spec.rb' - - 'spec/lib/ostatus/tag_manager_spec.rb' - - 'spec/lib/plain_text_formatter_spec.rb' - - 'spec/lib/text_formatter_spec.rb' - - 'spec/models/concerns/account_interactions_spec.rb' - - 'spec/models/custom_emoji_spec.rb' - - 'spec/models/media_attachment_spec.rb' - - 'spec/models/notification_spec.rb' - - 'spec/models/remote_follow_spec.rb' - - 'spec/models/report_spec.rb' - - 'spec/models/session_activation_spec.rb' - - 'spec/models/setting_spec.rb' - # Offense count: 101 # Configuration parameters: AssignmentOnly. RSpec/InstanceVariable: @@ -1199,7 +1167,7 @@ RSpec/MissingExampleGroupArgument: RSpec/MultipleExpectations: Max: 19 -# Offense count: 443 +# Offense count: 442 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: Max: 21 @@ -1216,7 +1184,7 @@ RSpec/MultipleSubjects: - 'spec/controllers/follower_accounts_controller_spec.rb' - 'spec/controllers/following_accounts_controller_spec.rb' -# Offense count: 1252 +# Offense count: 1407 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: @@ -1226,6 +1194,7 @@ RSpec/NamedSubject: - 'spec/controllers/admin/confirmations_controller_spec.rb' - 'spec/controllers/admin/custom_emojis_controller_spec.rb' - 'spec/controllers/admin/domain_blocks_controller_spec.rb' + - 'spec/controllers/admin/instances_controller_spec.rb' - 'spec/controllers/admin/invites_controller_spec.rb' - 'spec/controllers/admin/report_notes_controller_spec.rb' - 'spec/controllers/api/v1/accounts/notes_controller_spec.rb' @@ -1233,13 +1202,18 @@ RSpec/NamedSubject: - 'spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb' - 'spec/controllers/auth/passwords_controller_spec.rb' - 'spec/controllers/auth/registrations_controller_spec.rb' + - 'spec/controllers/home_controller_spec.rb' - 'spec/controllers/invites_controller_spec.rb' - 'spec/controllers/oauth/authorizations_controller_spec.rb' - 'spec/controllers/oauth/authorized_applications_controller_spec.rb' - 'spec/controllers/relationships_controller_spec.rb' - 'spec/controllers/settings/featured_tags_controller_spec.rb' + - 'spec/controllers/settings/migrations_controller_spec.rb' + - 'spec/controllers/settings/sessions_controller_spec.rb' - 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb' - 'spec/controllers/well_known/webfinger_controller_spec.rb' + - 'spec/features/log_in_spec.rb' + - 'spec/features/profile_spec.rb' - 'spec/lib/activitypub/activity/accept_spec.rb' - 'spec/lib/activitypub/activity/add_spec.rb' - 'spec/lib/activitypub/activity/announce_spec.rb' @@ -1262,16 +1236,21 @@ RSpec/NamedSubject: - 'spec/lib/connection_pool/shared_timed_stack_spec.rb' - 'spec/lib/delivery_failure_tracker_spec.rb' - 'spec/lib/emoji_formatter_spec.rb' + - 'spec/lib/entity_cache_spec.rb' - 'spec/lib/fast_ip_map_spec.rb' - 'spec/lib/feed_manager_spec.rb' - 'spec/lib/hashtag_normalizer_spec.rb' + - 'spec/lib/html_aware_formatter_spec.rb' - 'spec/lib/link_details_extractor_spec.rb' + - 'spec/lib/ostatus/tag_manager_spec.rb' + - 'spec/lib/plain_text_formatter_spec.rb' - 'spec/lib/request_pool_spec.rb' - 'spec/lib/request_spec.rb' - 'spec/lib/sanitize_config_spec.rb' - 'spec/lib/status_finder_spec.rb' - 'spec/lib/status_reach_finder_spec.rb' - 'spec/lib/suspicious_sign_in_detector_spec.rb' + - 'spec/lib/text_formatter_spec.rb' - 'spec/lib/vacuum/access_tokens_vacuum_spec.rb' - 'spec/lib/vacuum/backups_vacuum_spec.rb' - 'spec/lib/vacuum/feeds_vacuum_spec.rb' @@ -1288,11 +1267,17 @@ RSpec/NamedSubject: - 'spec/models/canonical_email_block_spec.rb' - 'spec/models/concerns/account_interactions_spec.rb' - 'spec/models/custom_emoji_filter_spec.rb' + - 'spec/models/custom_emoji_spec.rb' - 'spec/models/follow_spec.rb' - 'spec/models/home_feed_spec.rb' + - 'spec/models/media_attachment_spec.rb' - 'spec/models/notification_spec.rb' - 'spec/models/public_feed_spec.rb' - 'spec/models/relationship_filter_spec.rb' + - 'spec/models/remote_follow_spec.rb' + - 'spec/models/report_spec.rb' + - 'spec/models/session_activation_spec.rb' + - 'spec/models/setting_spec.rb' - 'spec/models/status_spec.rb' - 'spec/models/tag_spec.rb' - 'spec/models/trends/statuses_spec.rb' @@ -2347,46 +2332,25 @@ Style/FormatStringToken: Style/FrozenStringLiteralComment: Enabled: false -# Offense count: 69 +# Offense count: 34 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. Style/GuardClause: Exclude: - 'app/controllers/admin/confirmations_controller.rb' - - 'app/controllers/admin/domain_blocks_controller.rb' - - 'app/controllers/api/v1/accounts/follower_accounts_controller.rb' - - 'app/controllers/api/v1/accounts/following_accounts_controller.rb' - - 'app/controllers/api/v1/accounts/statuses_controller.rb' - - 'app/controllers/api/v1/blocks_controller.rb' - - 'app/controllers/api/v1/conversations_controller.rb' - - 'app/controllers/api/v1/domain_blocks_controller.rb' - - 'app/controllers/api/v1/endorsements_controller.rb' - - 'app/controllers/api/v1/favourites_controller.rb' - - 'app/controllers/api/v1/follow_requests_controller.rb' - - 'app/controllers/api/v1/lists/accounts_controller.rb' - - 'app/controllers/api/v1/mutes_controller.rb' - - 'app/controllers/api/v1/notifications_controller.rb' - - 'app/controllers/api/v1/scheduled_statuses_controller.rb' - - 'app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb' - - 'app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb' - 'app/controllers/auth/confirmations_controller.rb' - 'app/controllers/auth/passwords_controller.rb' - - 'app/controllers/filters/statuses_controller.rb' - 'app/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb' - 'app/lib/activitypub/activity/block.rb' - - 'app/lib/activitypub/linked_data_signature.rb' - 'app/lib/connection_pool/shared_connection_pool.rb' - 'app/lib/request.rb' - 'app/lib/request_pool.rb' - - 'app/lib/status_finder.rb' - 'app/lib/webfinger.rb' - 'app/lib/webfinger_resource.rb' - - 'app/models/account_statuses_cleanup_policy.rb' - 'app/models/concerns/account_counters.rb' - 'app/models/concerns/ldap_authenticable.rb' - 'app/models/tag.rb' - 'app/models/user.rb' - - 'app/serializers/rest/instance_serializer.rb' - 'app/services/fan_out_on_write_service.rb' - 'app/services/post_status_service.rb' - 'app/services/process_hashtags_service.rb' diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index fa1ddc6d3..7905444e9 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -65,7 +65,6 @@ class InitialStateSerializer < ActiveModel::Serializer store end - # rubocop:enable Metrics/AbcSize def compose store = {} diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index f5d68a8ad..fdc98ed46 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -83,7 +83,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:target_role) { UserRole.find_by(name: 'Admin') } it 'fails to memorialize account' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 expect(account.reload).to_not be_memorial end end @@ -92,7 +92,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:target_role) { UserRole.find_by(name: 'Moderator') } it 'succeeds in memorializing account' do - is_expected.to redirect_to admin_account_path(account.id) + expect(subject).to redirect_to admin_account_path(account.id) expect(account.reload).to be_memorial end end @@ -105,7 +105,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:target_role) { UserRole.find_by(name: 'Admin') } it 'fails to memorialize account' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 expect(account.reload).to_not be_memorial end end @@ -114,7 +114,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:target_role) { UserRole.find_by(name: 'Moderator') } it 'fails to memorialize account' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 expect(account.reload).to_not be_memorial end end @@ -132,7 +132,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.find_by(name: 'Admin') } it 'succeeds in enabling account' do - is_expected.to redirect_to admin_account_path(account.id) + expect(subject).to redirect_to admin_account_path(account.id) expect(user.reload).to_not be_disabled end end @@ -141,7 +141,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to enable account' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 expect(user.reload).to be_disabled end end @@ -162,12 +162,12 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.find_by(name: 'Admin') } it 'succeeds in approving account' do - is_expected.to redirect_to admin_accounts_path(status: 'pending') + expect(subject).to redirect_to admin_accounts_path(status: 'pending') expect(user.reload).to be_approved end it 'logs action' do - is_expected.to have_http_status 302 + expect(subject).to have_http_status 302 log_item = Admin::ActionLog.last @@ -182,7 +182,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to approve account' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 expect(user.reload).to_not be_approved end end @@ -203,11 +203,11 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.find_by(name: 'Admin') } it 'succeeds in rejecting account' do - is_expected.to redirect_to admin_accounts_path(status: 'pending') + expect(subject).to redirect_to admin_accounts_path(status: 'pending') end it 'logs action' do - is_expected.to have_http_status 302 + expect(subject).to have_http_status 302 log_item = Admin::ActionLog.last @@ -222,7 +222,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to reject account' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 expect(user.reload).to_not be_approved end end @@ -242,7 +242,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.find_by(name: 'Admin') } it 'succeeds in redownloading' do - is_expected.to redirect_to admin_account_path(account.id) + expect(subject).to redirect_to admin_account_path(account.id) end end @@ -250,7 +250,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to redownload' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 end end end @@ -265,7 +265,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.find_by(name: 'Admin') } it 'succeeds in removing avatar' do - is_expected.to redirect_to admin_account_path(account.id) + expect(subject).to redirect_to admin_account_path(account.id) end end @@ -273,7 +273,7 @@ RSpec.describe Admin::AccountsController, type: :controller do let(:role) { UserRole.everyone } it 'fails to remove avatar' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 end end end diff --git a/spec/controllers/admin/instances_controller_spec.rb b/spec/controllers/admin/instances_controller_spec.rb index a7e348b1c..4716e486a 100644 --- a/spec/controllers/admin/instances_controller_spec.rb +++ b/spec/controllers/admin/instances_controller_spec.rb @@ -42,7 +42,7 @@ RSpec.describe Admin::InstancesController, type: :controller do let(:role) { UserRole.find_by(name: 'Admin') } it 'succeeds in purging instance' do - is_expected.to redirect_to admin_instances_path + expect(subject).to redirect_to admin_instances_path end end @@ -50,7 +50,7 @@ RSpec.describe Admin::InstancesController, type: :controller do let(:role) { nil } it 'fails to purge instance' do - is_expected.to have_http_status 403 + expect(subject).to have_http_status 403 end end end diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index f14c451de..e2a63002b 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -28,7 +28,7 @@ describe ApplicationController, type: :controller do end it 'renders template for http' do - is_expected.to render_template("errors/#{code}", layout: 'error') + expect(subject).to render_template("errors/#{code}", layout: 'error') end end diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index d845ae01d..2409bf42c 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -9,7 +9,7 @@ RSpec.describe HomeController, type: :controller do context 'when not signed in' do it 'returns http success' do @request.path = '/' - is_expected.to have_http_status(:success) + expect(subject).to have_http_status(:success) end end @@ -21,7 +21,7 @@ RSpec.describe HomeController, type: :controller do end it 'returns http success' do - is_expected.to have_http_status(:success) + expect(subject).to have_http_status(:success) end end end diff --git a/spec/controllers/relationships_controller_spec.rb b/spec/controllers/relationships_controller_spec.rb index cd09cf50b..4c4227d66 100644 --- a/spec/controllers/relationships_controller_spec.rb +++ b/spec/controllers/relationships_controller_spec.rb @@ -7,7 +7,7 @@ describe RelationshipsController do shared_examples 'authenticate user' do it 'redirects when not signed in' do - is_expected.to redirect_to '/auth/sign_in' + expect(subject).to redirect_to '/auth/sign_in' end end diff --git a/spec/controllers/settings/featured_tags_controller_spec.rb b/spec/controllers/settings/featured_tags_controller_spec.rb index 33b87f9f6..fc338672d 100644 --- a/spec/controllers/settings/featured_tags_controller_spec.rb +++ b/spec/controllers/settings/featured_tags_controller_spec.rb @@ -5,7 +5,7 @@ describe Settings::FeaturedTagsController do shared_examples 'authenticate user' do it 'redirects to sign_in page' do - is_expected.to redirect_to new_user_session_path + expect(subject).to redirect_to new_user_session_path end end diff --git a/spec/controllers/settings/migrations_controller_spec.rb b/spec/controllers/settings/migrations_controller_spec.rb index 4ce153c9d..8159bb21b 100644 --- a/spec/controllers/settings/migrations_controller_spec.rb +++ b/spec/controllers/settings/migrations_controller_spec.rb @@ -5,7 +5,7 @@ describe Settings::MigrationsController do shared_examples 'authenticate user' do it 'redirects to sign_in page' do - is_expected.to redirect_to new_user_session_path + expect(subject).to redirect_to new_user_session_path end end @@ -27,8 +27,8 @@ describe Settings::MigrationsController do let(:moved_to_account) { nil } it 'renders show page' do - is_expected.to have_http_status 200 - is_expected.to render_template :show + expect(subject).to have_http_status 200 + expect(subject).to render_template :show end end @@ -36,8 +36,8 @@ describe Settings::MigrationsController do let(:moved_to_account) { Fabricate(:account) } it 'renders show page' do - is_expected.to have_http_status 200 - is_expected.to render_template :show + expect(subject).to have_http_status 200 + expect(subject).to render_template :show end end end @@ -61,7 +61,7 @@ describe Settings::MigrationsController do let(:acct) { Fabricate(:account, also_known_as: [ActivityPub::TagManager.instance.uri_for(user.account)]) } it 'updates moved to account' do - is_expected.to redirect_to settings_migration_path + expect(subject).to redirect_to settings_migration_path expect(user.account.reload.moved_to_account_id).to eq acct.id end end @@ -70,7 +70,7 @@ describe Settings::MigrationsController do let(:acct) { user.account } it 'renders show' do - is_expected.to render_template :show + expect(subject).to render_template :show end it 'does not update the moved account' do @@ -82,7 +82,7 @@ describe Settings::MigrationsController do let(:acct) { Fabricate(:account, also_known_as: []) } it 'renders show' do - is_expected.to render_template :show + expect(subject).to render_template :show end it 'does not update the moved account' do @@ -99,7 +99,7 @@ describe Settings::MigrationsController do end it 'renders show' do - is_expected.to render_template :show + expect(subject).to render_template :show end it 'does not update the moved account' do diff --git a/spec/controllers/settings/sessions_controller_spec.rb b/spec/controllers/settings/sessions_controller_spec.rb index 59c18889e..fdf46d947 100644 --- a/spec/controllers/settings/sessions_controller_spec.rb +++ b/spec/controllers/settings/sessions_controller_spec.rb @@ -15,7 +15,7 @@ describe Settings::SessionsController do let(:id) { session_activation.id } it 'destroys session activation' do - is_expected.to redirect_to edit_user_registration_path + expect(subject).to redirect_to edit_user_registration_path expect(SessionActivation.find_by(id: id)).to be_nil end end @@ -24,7 +24,7 @@ describe Settings::SessionsController do let(:id) { session_activation.id + 1000 } it 'destroys session activation' do - is_expected.to have_http_status 404 + expect(subject).to have_http_status 404 end end end diff --git a/spec/features/log_in_spec.rb b/spec/features/log_in_spec.rb index 5ae738ee2..934575ea6 100644 --- a/spec/features/log_in_spec.rb +++ b/spec/features/log_in_spec.rb @@ -21,7 +21,7 @@ describe 'Log in' do fill_in 'user_password', with: password click_on I18n.t('auth.login') - is_expected.to have_css('div.app-holder') + expect(subject).to have_css('div.app-holder') end it 'A invalid email and password user is not able to log in' do @@ -29,7 +29,7 @@ describe 'Log in' do fill_in 'user_password', with: 'invalid_password' click_on I18n.t('auth.login') - is_expected.to have_css('.flash-message', text: failure_message('invalid')) + expect(subject).to have_css('.flash-message', text: failure_message('invalid')) end context do @@ -40,7 +40,7 @@ describe 'Log in' do fill_in 'user_password', with: password click_on I18n.t('auth.login') - is_expected.to have_css('div.admin-wrapper') + expect(subject).to have_css('div.admin-wrapper') end end diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index d1c6919c1..421b68a16 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -17,7 +17,7 @@ describe 'Profile' do it 'I can view Annes public account' do visit account_path('alice') - is_expected.to have_title("alice (@alice@#{local_domain})") + expect(subject).to have_title("alice (@alice@#{local_domain})") end it 'I can change my account' do @@ -28,6 +28,6 @@ describe 'Profile' do first('button[type=submit]').click - is_expected.to have_content 'Changes successfully saved!' + expect(subject).to have_content 'Changes successfully saved!' end end diff --git a/spec/lib/emoji_formatter_spec.rb b/spec/lib/emoji_formatter_spec.rb index e1747bdd9..c6fe8cf37 100644 --- a/spec/lib/emoji_formatter_spec.rb +++ b/spec/lib/emoji_formatter_spec.rb @@ -24,7 +24,7 @@ RSpec.describe EmojiFormatter do let(:text) { preformat_text(':coolcat: Beep boop') } it 'converts the shortcode to an image tag' do - is_expected.to match(/:coolcat:Foo bar

' + expect(subject).to eq '

Foo bar

' end end @@ -20,7 +20,7 @@ RSpec.describe HtmlAwareFormatter do let(:text) { 'Beep boop' } it 'keeps the plain text' do - is_expected.to include 'Beep boop' + expect(subject).to include 'Beep boop' end end @@ -28,7 +28,7 @@ RSpec.describe HtmlAwareFormatter do let(:text) { '' } it 'strips the scripts' do - is_expected.to_not include '' + expect(subject).to_not include '' end end @@ -36,7 +36,7 @@ RSpec.describe HtmlAwareFormatter do let(:text) { 'Show more' } it 'strips the malicious classes' do - is_expected.to_not include 'status__content__spoiler-link' + expect(subject).to_not include 'status__content__spoiler-link' end end end diff --git a/spec/lib/ostatus/tag_manager_spec.rb b/spec/lib/ostatus/tag_manager_spec.rb index 31195bae2..65ba7577a 100644 --- a/spec/lib/ostatus/tag_manager_spec.rb +++ b/spec/lib/ostatus/tag_manager_spec.rb @@ -45,7 +45,7 @@ describe OStatus::TagManager do it 'returns the unique tag for status' do expect(target.object_type).to eq :comment - is_expected.to eq target.uri + expect(subject).to eq target.uri end end @@ -54,7 +54,7 @@ describe OStatus::TagManager do it 'returns the unique tag for status' do expect(target.object_type).to eq :note - is_expected.to eq target.uri + expect(subject).to eq target.uri end end @@ -63,7 +63,7 @@ describe OStatus::TagManager do it 'returns the URL for account' do expect(target.object_type).to eq :person - is_expected.to eq 'https://cb6e6126.ngrok.io/users/alice' + expect(subject).to eq 'https://cb6e6126.ngrok.io/users/alice' end end end diff --git a/spec/lib/plain_text_formatter_spec.rb b/spec/lib/plain_text_formatter_spec.rb index c3d0ee630..0e5f39031 100644 --- a/spec/lib/plain_text_formatter_spec.rb +++ b/spec/lib/plain_text_formatter_spec.rb @@ -8,7 +8,7 @@ RSpec.describe PlainTextFormatter do let(:status) { Fabricate(:status, text: '

a text by a nerd who uses an HTML tag in text

', uri: nil) } it 'returns the raw text' do - is_expected.to eq '

a text by a nerd who uses an HTML tag in text

' + expect(subject).to eq '

a text by a nerd who uses an HTML tag in text

' end end @@ -17,7 +17,7 @@ RSpec.describe PlainTextFormatter do let(:status) { Fabricate(:status, account: remote_account, text: '

Hello

') } it 'returns tag-stripped text' do - is_expected.to eq 'Hello' + expect(subject).to eq 'Hello' end end end diff --git a/spec/lib/text_formatter_spec.rb b/spec/lib/text_formatter_spec.rb index cc742b65e..63a9075c7 100644 --- a/spec/lib/text_formatter_spec.rb +++ b/spec/lib/text_formatter_spec.rb @@ -10,7 +10,7 @@ RSpec.describe TextFormatter do let(:text) { 'text' } it 'paragraphizes the text' do - is_expected.to eq '

text

' + expect(subject).to eq '

text

' end end @@ -18,7 +18,7 @@ RSpec.describe TextFormatter do let(:text) { "line\nfeed" } it 'removes line feeds' do - is_expected.to_not include "\n" + expect(subject).to_not include "\n" end end @@ -27,7 +27,7 @@ RSpec.describe TextFormatter do let(:text) { '@alice' } it 'creates a mention link' do - is_expected.to include '@alice' + expect(subject).to include '@alice' end end @@ -36,7 +36,7 @@ RSpec.describe TextFormatter do let(:text) { '@alice' } it 'does not create a mention link' do - is_expected.to include '@alice' + expect(subject).to include '@alice' end end @@ -44,7 +44,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://hackernoon.com/the-power-to-build-communities-a-response-to-mark-zuckerberg-3f2cac9148a4' } it 'matches the full URL' do - is_expected.to include 'href="https://hackernoon.com/the-power-to-build-communities-a-response-to-mark-zuckerberg-3f2cac9148a4"' + expect(subject).to include 'href="https://hackernoon.com/the-power-to-build-communities-a-response-to-mark-zuckerberg-3f2cac9148a4"' end end @@ -52,7 +52,7 @@ RSpec.describe TextFormatter do let(:text) { 'http://google.com' } it 'matches the full URL' do - is_expected.to include 'href="http://google.com"' + expect(subject).to include 'href="http://google.com"' end end @@ -60,7 +60,7 @@ RSpec.describe TextFormatter do let(:text) { 'http://example.gay' } it 'matches the full URL' do - is_expected.to include 'href="http://example.gay"' + expect(subject).to include 'href="http://example.gay"' end end @@ -68,11 +68,11 @@ RSpec.describe TextFormatter do let(:text) { 'https://nic.みんな/' } it 'matches the full URL' do - is_expected.to include 'href="https://nic.みんな/"' + expect(subject).to include 'href="https://nic.みんな/"' end it 'has display URL' do - is_expected.to include 'nic.みんな/' + expect(subject).to include 'nic.みんな/' end end @@ -80,7 +80,7 @@ RSpec.describe TextFormatter do let(:text) { 'http://www.mcmansionhell.com/post/156408871451/50-states-of-mcmansion-hell-scottsdale-arizona. ' } it 'matches the full URL but not the period' do - is_expected.to include 'href="http://www.mcmansionhell.com/post/156408871451/50-states-of-mcmansion-hell-scottsdale-arizona"' + expect(subject).to include 'href="http://www.mcmansionhell.com/post/156408871451/50-states-of-mcmansion-hell-scottsdale-arizona"' end end @@ -88,7 +88,7 @@ RSpec.describe TextFormatter do let(:text) { '(http://google.com/)' } it 'matches the full URL but not the parentheses' do - is_expected.to include 'href="http://google.com/"' + expect(subject).to include 'href="http://google.com/"' end end @@ -96,7 +96,7 @@ RSpec.describe TextFormatter do let(:text) { 'http://www.google.com!' } it 'matches the full URL but not the exclamation point' do - is_expected.to include 'href="http://www.google.com"' + expect(subject).to include 'href="http://www.google.com"' end end @@ -104,7 +104,7 @@ RSpec.describe TextFormatter do let(:text) { "http://www.google.com'" } it 'matches the full URL but not the single quote' do - is_expected.to include 'href="http://www.google.com"' + expect(subject).to include 'href="http://www.google.com"' end end @@ -112,7 +112,7 @@ RSpec.describe TextFormatter do let(:text) { 'http://www.google.com>' } it 'matches the full URL but not the angle bracket' do - is_expected.to include 'href="http://www.google.com"' + expect(subject).to include 'href="http://www.google.com"' end end @@ -121,7 +121,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=autolink' } it 'matches the full URL' do - is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=autolink"' + expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=autolink"' end end @@ -129,7 +129,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓&q=autolink' } it 'matches the full URL' do - is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=✓&q=autolink"' + expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=✓&q=autolink"' end end @@ -137,7 +137,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓' } it 'matches the full URL' do - is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=✓"' + expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=✓"' end end @@ -145,7 +145,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&utf81=✓&q=autolink' } it 'preserves escaped unicode characters' do - is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&utf81=✓&q=autolink"' + expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&utf81=✓&q=autolink"' end end end @@ -154,7 +154,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://en.wikipedia.org/wiki/Diaspora_(software)' } it 'matches the full URL' do - is_expected.to include 'href="https://en.wikipedia.org/wiki/Diaspora_(software)"' + expect(subject).to include 'href="https://en.wikipedia.org/wiki/Diaspora_(software)"' end end @@ -162,7 +162,7 @@ RSpec.describe TextFormatter do let(:text) { '"https://example.com/"' } it 'does not match the quotation marks' do - is_expected.to include 'href="https://example.com/"' + expect(subject).to include 'href="https://example.com/"' end end @@ -170,7 +170,7 @@ RSpec.describe TextFormatter do let(:text) { '' } it 'does not match the angle brackets' do - is_expected.to include 'href="https://example.com/"' + expect(subject).to include 'href="https://example.com/"' end end @@ -178,7 +178,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://ja.wikipedia.org/wiki/日本' } it 'matches the full URL' do - is_expected.to include 'href="https://ja.wikipedia.org/wiki/日本"' + expect(subject).to include 'href="https://ja.wikipedia.org/wiki/日本"' end end @@ -186,7 +186,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://ko.wikipedia.org/wiki/대한민국' } it 'matches the full URL' do - is_expected.to include 'href="https://ko.wikipedia.org/wiki/대한민국"' + expect(subject).to include 'href="https://ko.wikipedia.org/wiki/대한민국"' end end @@ -194,7 +194,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://example.com/ abc123' } it 'does not match the full-width space' do - is_expected.to include 'href="https://example.com/"' + expect(subject).to include 'href="https://example.com/"' end end @@ -202,7 +202,7 @@ RSpec.describe TextFormatter do let(:text) { '「[https://example.org/」' } it 'does not match the quotation marks' do - is_expected.to include 'href="https://example.org/"' + expect(subject).to include 'href="https://example.org/"' end end @@ -210,7 +210,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://baike.baidu.com/item/中华人民共和国' } it 'matches the full URL' do - is_expected.to include 'href="https://baike.baidu.com/item/中华人民共和国"' + expect(subject).to include 'href="https://baike.baidu.com/item/中华人民共和国"' end end @@ -218,7 +218,7 @@ RSpec.describe TextFormatter do let(:text) { 'https://zh.wikipedia.org/wiki/臺灣' } it 'matches the full URL' do - is_expected.to include 'href="https://zh.wikipedia.org/wiki/臺灣"' + expect(subject).to include 'href="https://zh.wikipedia.org/wiki/臺灣"' end end @@ -226,11 +226,11 @@ RSpec.describe TextFormatter do let(:text) { 'http://example.com/bb' } it 'does not include the HTML in the URL' do - is_expected.to include '"http://example.com/b"' + expect(subject).to include '"http://example.com/b"' end it 'escapes the HTML' do - is_expected.to include '<del>b</del>' + expect(subject).to include '<del>b</del>' end end @@ -238,11 +238,11 @@ RSpec.describe TextFormatter do let(:text) { 'http://example.com/blahblahblahblah/a' } it 'does not include the HTML in the URL' do - is_expected.to include '"http://example.com/blahblahblahblah/a"' + expect(subject).to include '"http://example.com/blahblahblahblah/a"' end it 'escapes the HTML' do - is_expected.to include '<script>alert("Hello")</script>' + expect(subject).to include '<script>alert("Hello")</script>' end end @@ -250,7 +250,7 @@ RSpec.describe TextFormatter do let(:text) { '' } it 'escapes the HTML' do - is_expected.to include '

<script>alert("Hello")</script>

' + expect(subject).to include '

<script>alert("Hello")</script>

' end end @@ -258,7 +258,7 @@ RSpec.describe TextFormatter do let(:text) { %q{} } it 'escapes the HTML' do - is_expected.to include '

<img src="javascript:alert('XSS');">

' + expect(subject).to include '

<img src="javascript:alert('XSS');">

' end end @@ -266,7 +266,7 @@ RSpec.describe TextFormatter do let(:text) { 'http://www\.google\.com' } it 'outputs the raw URL' do - is_expected.to eq '

http://www\.google\.com

' + expect(subject).to eq '

http://www\.google\.com

' end end @@ -274,7 +274,7 @@ RSpec.describe TextFormatter do let(:text) { '#hashtag' } it 'creates a hashtag link' do - is_expected.to include '/tags/hashtag" class="mention hashtag" rel="tag">#hashtag' + expect(subject).to include '/tags/hashtag" class="mention hashtag" rel="tag">#hashtag' end end @@ -282,7 +282,7 @@ RSpec.describe TextFormatter do let(:text) { '#hashtagタグ' } it 'creates a hashtag link' do - is_expected.to include '/tags/hashtag%E3%82%BF%E3%82%B0" class="mention hashtag" rel="tag">#hashtagタグ' + expect(subject).to include '/tags/hashtag%E3%82%BF%E3%82%B0" class="mention hashtag" rel="tag">#hashtagタグ' end end @@ -290,7 +290,7 @@ RSpec.describe TextFormatter do let(:text) { 'xmpp:user@instance.com' } it 'matches the full URI' do - is_expected.to include 'href="xmpp:user@instance.com"' + expect(subject).to include 'href="xmpp:user@instance.com"' end end @@ -298,7 +298,7 @@ RSpec.describe TextFormatter do let(:text) { 'please join xmpp:muc@instance.com?join right now' } it 'matches the full URI' do - is_expected.to include 'href="xmpp:muc@instance.com?join"' + expect(subject).to include 'href="xmpp:muc@instance.com?join"' end end @@ -306,7 +306,7 @@ RSpec.describe TextFormatter do let(:text) { 'wikipedia gives this example of a magnet uri: magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a' } it 'matches the full URI' do - is_expected.to include 'href="magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a"' + expect(subject).to include 'href="magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a"' end end end diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb index b2d84308b..fbfc9fbbc 100644 --- a/spec/models/concerns/account_interactions_spec.rb +++ b/spec/models/concerns/account_interactions_spec.rb @@ -14,13 +14,13 @@ describe AccountInteractions do context 'account with Follow' do it 'returns { target_account_id => true }' do Fabricate(:follow, account: account, target_account: target_account) - is_expected.to eq(target_account_id => { reblogs: true, notify: false, languages: nil }) + expect(subject).to eq(target_account_id => { reblogs: true, notify: false, languages: nil }) end end context 'account without Follow' do it 'returns {}' do - is_expected.to eq({}) + expect(subject).to eq({}) end end end @@ -31,13 +31,13 @@ describe AccountInteractions do context 'account with Follow' do it 'returns { target_account_id => true }' do Fabricate(:follow, account: target_account, target_account: account) - is_expected.to eq(target_account_id => true) + expect(subject).to eq(target_account_id => true) end end context 'account without Follow' do it 'returns {}' do - is_expected.to eq({}) + expect(subject).to eq({}) end end end @@ -48,13 +48,13 @@ describe AccountInteractions do context 'account with Block' do it 'returns { target_account_id => true }' do Fabricate(:block, account: account, target_account: target_account) - is_expected.to eq(target_account_id => true) + expect(subject).to eq(target_account_id => true) end end context 'account without Block' do it 'returns {}' do - is_expected.to eq({}) + expect(subject).to eq({}) end end end @@ -71,7 +71,7 @@ describe AccountInteractions do let(:hide) { true } it 'returns { target_account_id => { notifications: true } }' do - is_expected.to eq(target_account_id => { notifications: true }) + expect(subject).to eq(target_account_id => { notifications: true }) end end @@ -79,14 +79,14 @@ describe AccountInteractions do let(:hide) { false } it 'returns { target_account_id => { notifications: false } }' do - is_expected.to eq(target_account_id => { notifications: false }) + expect(subject).to eq(target_account_id => { notifications: false }) end end end context 'account without Mute' do it 'returns {}' do - is_expected.to eq({}) + expect(subject).to eq({}) end end end @@ -231,7 +231,7 @@ describe AccountInteractions do it 'creates and returns ConversationMute' do expect do - is_expected.to be_a ConversationMute + expect(subject).to be_a ConversationMute end.to change { account.conversation_mutes.count }.by 1 end end @@ -243,7 +243,7 @@ describe AccountInteractions do it 'creates and returns AccountDomainBlock' do expect do - is_expected.to be_a AccountDomainBlock + expect(subject).to be_a AccountDomainBlock end.to change { account.domain_blocks.count }.by 1 end end @@ -254,14 +254,14 @@ describe AccountInteractions do context 'following target_account' do it 'returns destroyed Follow' do account.active_relationships.create(target_account: target_account) - is_expected.to be_a Follow + expect(subject).to be_a Follow expect(subject).to be_destroyed end end context 'not following target_account' do it 'returns nil' do - is_expected.to be_nil + expect(subject).to be_nil end end end @@ -272,14 +272,14 @@ describe AccountInteractions do context 'blocking target_account' do it 'returns destroyed Block' do account.block_relationships.create(target_account: target_account) - is_expected.to be_a Block + expect(subject).to be_a Block expect(subject).to be_destroyed end end context 'not blocking target_account' do it 'returns nil' do - is_expected.to be_nil + expect(subject).to be_nil end end end @@ -290,14 +290,14 @@ describe AccountInteractions do context 'muting target_account' do it 'returns destroyed Mute' do account.mute_relationships.create(target_account: target_account) - is_expected.to be_a Mute + expect(subject).to be_a Mute expect(subject).to be_destroyed end end context 'not muting target_account' do it 'returns nil' do - is_expected.to be_nil + expect(subject).to be_nil end end end @@ -310,14 +310,14 @@ describe AccountInteractions do context 'muting the conversation' do it 'returns destroyed ConversationMute' do account.conversation_mutes.create(conversation: conversation) - is_expected.to be_a ConversationMute + expect(subject).to be_a ConversationMute expect(subject).to be_destroyed end end context 'not muting the conversation' do it 'returns nil' do - is_expected.to be_nil + expect(subject).to be_nil end end end @@ -331,14 +331,14 @@ describe AccountInteractions do it 'returns destroyed AccountDomainBlock' do account_domain_block = Fabricate(:account_domain_block, domain: domain) account.domain_blocks << account_domain_block - is_expected.to be_a AccountDomainBlock + expect(subject).to be_a AccountDomainBlock expect(subject).to be_destroyed end end context 'unblocking the domain' do it 'returns nil' do - is_expected.to be_nil + expect(subject).to be_nil end end end @@ -349,13 +349,13 @@ describe AccountInteractions do context 'following target_account' do it 'returns true' do account.active_relationships.create(target_account: target_account) - is_expected.to be true + expect(subject).to be true end end context 'not following target_account' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -366,13 +366,13 @@ describe AccountInteractions do context 'followed by target_account' do it 'returns true' do account.passive_relationships.create(account: target_account) - is_expected.to be true + expect(subject).to be true end end context 'not followed by target_account' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -383,13 +383,13 @@ describe AccountInteractions do context 'blocking target_account' do it 'returns true' do account.block_relationships.create(target_account: target_account) - is_expected.to be true + expect(subject).to be true end end context 'not blocking target_account' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -403,13 +403,13 @@ describe AccountInteractions do it 'returns true' do account_domain_block = Fabricate(:account_domain_block, domain: domain) account.domain_blocks << account_domain_block - is_expected.to be true + expect(subject).to be true end end context 'not blocking the domain' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -421,13 +421,13 @@ describe AccountInteractions do it 'returns true' do mute = Fabricate(:mute, account: account, target_account: target_account) account.mute_relationships << mute - is_expected.to be true + expect(subject).to be true end end context 'not muting target_account' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -440,13 +440,13 @@ describe AccountInteractions do context 'muting the conversation' do it 'returns true' do account.conversation_mutes.create(conversation: conversation) - is_expected.to be true + expect(subject).to be true end end context 'not muting the conversation' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -463,7 +463,7 @@ describe AccountInteractions do let(:hide) { true } it 'returns true' do - is_expected.to be true + expect(subject).to be true end end @@ -471,7 +471,7 @@ describe AccountInteractions do let(:hide) { false } it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -482,13 +482,13 @@ describe AccountInteractions do context 'requested by target_account' do it 'returns true' do Fabricate(:follow_request, account: account, target_account: target_account) - is_expected.to be true + expect(subject).to be true end end context 'not requested by target_account' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -502,7 +502,7 @@ describe AccountInteractions do let(:favourites) { [Fabricate(:favourite, account: account)] } it 'returns true' do - is_expected.to be true + expect(subject).to be true end end @@ -510,7 +510,7 @@ describe AccountInteractions do let(:favourites) { [] } it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -524,7 +524,7 @@ describe AccountInteractions do let(:reblogs) { [Fabricate(:status, account: account)] } it 'returns true' do - is_expected.to be true + expect(subject).to be true end end @@ -532,7 +532,7 @@ describe AccountInteractions do let(:reblogs) { [] } it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -545,13 +545,13 @@ describe AccountInteractions do context 'pinned' do it 'returns true' do Fabricate(:status_pin, account: account, status: status) - is_expected.to be true + expect(subject).to be true end end context 'not pinned' do it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end diff --git a/spec/models/custom_emoji_spec.rb b/spec/models/custom_emoji_spec.rb index f9e1099c6..1fc112db3 100644 --- a/spec/models/custom_emoji_spec.rb +++ b/spec/models/custom_emoji_spec.rb @@ -11,7 +11,7 @@ RSpec.describe CustomEmoji, type: :model do let(:search_term) { 'blobpats' } it 'finds emoji' do - is_expected.to include(custom_emoji) + expect(subject).to include(custom_emoji) end end @@ -20,7 +20,7 @@ RSpec.describe CustomEmoji, type: :model do let(:search_term) { 'blob' } it 'finds emoji' do - is_expected.to include(custom_emoji) + expect(subject).to include(custom_emoji) end end end @@ -34,7 +34,7 @@ RSpec.describe CustomEmoji, type: :model do let(:domain) { nil } it 'returns true' do - is_expected.to be true + expect(subject).to be true end end @@ -42,7 +42,7 @@ RSpec.describe CustomEmoji, type: :model do let(:domain) { 'example.com' } it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -63,7 +63,7 @@ RSpec.describe CustomEmoji, type: :model do let(:text) { 'Hello :coolcat:' } it 'returns records used via shortcodes in text' do - is_expected.to include(emojo) + expect(subject).to include(emojo) end end @@ -71,7 +71,7 @@ RSpec.describe CustomEmoji, type: :model do let(:text) { '

Hello :coolcat:

' } it 'returns records used via shortcodes in text' do - is_expected.to include(emojo) + expect(subject).to include(emojo) end end end diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb index d1a94d41a..8889d5f7c 100644 --- a/spec/models/media_attachment_spec.rb +++ b/spec/models/media_attachment_spec.rb @@ -10,7 +10,7 @@ RSpec.describe MediaAttachment, type: :model do let(:remote_url) { '' } it 'returns true' do - is_expected.to be true + expect(subject).to be true end end @@ -18,7 +18,7 @@ RSpec.describe MediaAttachment, type: :model do let(:remote_url) { 'remote_url' } it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end @@ -35,7 +35,7 @@ RSpec.describe MediaAttachment, type: :model do let(:remote_url) { 'remote_url' } it 'returns true' do - is_expected.to be true + expect(subject).to be true end end end @@ -47,7 +47,7 @@ RSpec.describe MediaAttachment, type: :model do let(:remote_url) { '' } it 'returns false' do - is_expected.to be false + expect(subject).to be false end end @@ -55,7 +55,7 @@ RSpec.describe MediaAttachment, type: :model do let(:remote_url) { 'remote_url' } it 'returns true' do - is_expected.to be false + expect(subject).to be false end end end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 1e9e45d8d..a8fb77639 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -68,7 +68,7 @@ RSpec.describe Notification, type: :model do let(:notifications) { [] } it 'returns []' do - is_expected.to eq [] + expect(subject).to eq [] end end diff --git a/spec/models/remote_follow_spec.rb b/spec/models/remote_follow_spec.rb index 5b4c19b5b..c6bbecf25 100644 --- a/spec/models/remote_follow_spec.rb +++ b/spec/models/remote_follow_spec.rb @@ -17,7 +17,7 @@ RSpec.describe RemoteFollow do let(:attrs) { { acct: 'gargron@quitter.no' } } it 'returns acct' do - is_expected.to eq 'gargron@quitter.no' + expect(subject).to eq 'gargron@quitter.no' end end @@ -25,7 +25,7 @@ RSpec.describe RemoteFollow do let(:attrs) { {} } it do - is_expected.to be_nil + expect(subject).to be_nil end end end @@ -37,7 +37,7 @@ RSpec.describe RemoteFollow do let(:attrs) { { acct: 'gargron@quitter.no' } } it do - is_expected.to be true + expect(subject).to be true end end @@ -45,7 +45,7 @@ RSpec.describe RemoteFollow do let(:attrs) { {} } it do - is_expected.to be false + expect(subject).to be false end end end @@ -61,7 +61,7 @@ RSpec.describe RemoteFollow do subject { remote_follow.subscribe_address_for(account) } it 'returns subscribe address' do - is_expected.to eq 'https://quitter.no/main/ostatussub?profile=https%3A%2F%2Fcb6e6126.ngrok.io%2Fusers%2Falice' + expect(subject).to eq 'https://quitter.no/main/ostatussub?profile=https%3A%2F%2Fcb6e6126.ngrok.io%2Fusers%2Falice' end end end diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index 874be4132..317851297 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -33,7 +33,7 @@ describe Report do end it 'assigns to a given account' do - is_expected.to eq current_account.id + expect(subject).to eq current_account.id end end @@ -48,7 +48,7 @@ describe Report do end it 'unassigns' do - is_expected.to be_nil + expect(subject).to be_nil end end diff --git a/spec/models/session_activation_spec.rb b/spec/models/session_activation_spec.rb index 26f2b561a..375199d57 100644 --- a/spec/models/session_activation_spec.rb +++ b/spec/models/session_activation_spec.rb @@ -44,7 +44,7 @@ RSpec.describe SessionActivation, type: :model do let(:id) { nil } it 'returns nil' do - is_expected.to be_nil + expect(subject).to be_nil end end @@ -54,7 +54,7 @@ RSpec.describe SessionActivation, type: :model do context 'id exists as session_id' do it 'returns true' do - is_expected.to be true + expect(subject).to be true end end @@ -64,7 +64,7 @@ RSpec.describe SessionActivation, type: :model do end it 'returns false' do - is_expected.to be false + expect(subject).to be false end end end diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index 077223094..86fdf4e08 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -173,7 +173,7 @@ RSpec.describe Setting, type: :model do let(:enabled) { false } it 'returns {}' do - is_expected.to eq({}) + expect(subject).to eq({}) end end @@ -181,7 +181,7 @@ RSpec.describe Setting, type: :model do let(:enabled) { true } it 'returns instance of RailsSettings::Default' do - is_expected.to be_a RailsSettings::Default + expect(subject).to be_a RailsSettings::Default end end end