gearheads
/
mastodon
Archived
2
0
Fork 0

Autofix Rubocop RSpec/ImplicitSubject (#23721)

gh/dev
Nick Schonning 2023-02-19 23:00:48 -05:00 committed by GitHub
parent 63e6353886
commit 38a1d8bb85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 184 additions and 221 deletions

View File

@ -1,6 +1,6 @@
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` # `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 # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # 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/admin/account_action_spec.rb'
- 'spec/models/concerns/account_interactions_spec.rb' - 'spec/models/concerns/account_interactions_spec.rb'
# Offense count: 577 # Offense count: 581
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https # URISchemes: http, https
@ -305,18 +305,17 @@ Lint/Void:
Exclude: Exclude:
- 'spec/services/resolve_account_service_spec.rb' - 'spec/services/resolve_account_service_spec.rb'
# Offense count: 65 # Offense count: 66
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize: Metrics/AbcSize:
Enabled: false Enabled: false
# Offense count: 11 # Offense count: 10
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine # AllowedMethods: refine
Metrics/BlockLength: Metrics/BlockLength:
Exclude: Exclude:
- 'app/models/concerns/account_interactions.rb' - 'app/models/concerns/account_interactions.rb'
- 'app/models/concerns/omniauthable.rb'
- 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' - 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb'
- 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' - 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb'
- 'lib/tasks/branding.rake' - 'lib/tasks/branding.rake'
@ -335,7 +334,7 @@ Metrics/BlockNesting:
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Enabled: false Enabled: false
# Offense count: 40 # Offense count: 35
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength: Metrics/MethodLength:
Enabled: false Enabled: false
@ -936,37 +935,6 @@ RSpec/HookArgument:
- 'spec/services/import_service_spec.rb' - 'spec/services/import_service_spec.rb'
- 'spec/spec_helper.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 # Offense count: 101
# Configuration parameters: AssignmentOnly. # Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable: RSpec/InstanceVariable:
@ -1199,7 +1167,7 @@ RSpec/MissingExampleGroupArgument:
RSpec/MultipleExpectations: RSpec/MultipleExpectations:
Max: 19 Max: 19
# Offense count: 443 # Offense count: 442
# Configuration parameters: AllowSubject. # Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers: RSpec/MultipleMemoizedHelpers:
Max: 21 Max: 21
@ -1216,7 +1184,7 @@ RSpec/MultipleSubjects:
- 'spec/controllers/follower_accounts_controller_spec.rb' - 'spec/controllers/follower_accounts_controller_spec.rb'
- 'spec/controllers/following_accounts_controller_spec.rb' - 'spec/controllers/following_accounts_controller_spec.rb'
# Offense count: 1252 # Offense count: 1407
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only # SupportedStyles: always, named_only
RSpec/NamedSubject: RSpec/NamedSubject:
@ -1226,6 +1194,7 @@ RSpec/NamedSubject:
- 'spec/controllers/admin/confirmations_controller_spec.rb' - 'spec/controllers/admin/confirmations_controller_spec.rb'
- 'spec/controllers/admin/custom_emojis_controller_spec.rb' - 'spec/controllers/admin/custom_emojis_controller_spec.rb'
- 'spec/controllers/admin/domain_blocks_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/invites_controller_spec.rb'
- 'spec/controllers/admin/report_notes_controller_spec.rb' - 'spec/controllers/admin/report_notes_controller_spec.rb'
- 'spec/controllers/api/v1/accounts/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/api/v1/admin/domain_blocks_controller_spec.rb'
- 'spec/controllers/auth/passwords_controller_spec.rb' - 'spec/controllers/auth/passwords_controller_spec.rb'
- 'spec/controllers/auth/registrations_controller_spec.rb' - 'spec/controllers/auth/registrations_controller_spec.rb'
- 'spec/controllers/home_controller_spec.rb'
- 'spec/controllers/invites_controller_spec.rb' - 'spec/controllers/invites_controller_spec.rb'
- 'spec/controllers/oauth/authorizations_controller_spec.rb' - 'spec/controllers/oauth/authorizations_controller_spec.rb'
- 'spec/controllers/oauth/authorized_applications_controller_spec.rb' - 'spec/controllers/oauth/authorized_applications_controller_spec.rb'
- 'spec/controllers/relationships_controller_spec.rb' - 'spec/controllers/relationships_controller_spec.rb'
- 'spec/controllers/settings/featured_tags_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/settings/two_factor_authentication/confirmations_controller_spec.rb'
- 'spec/controllers/well_known/webfinger_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/accept_spec.rb'
- 'spec/lib/activitypub/activity/add_spec.rb' - 'spec/lib/activitypub/activity/add_spec.rb'
- 'spec/lib/activitypub/activity/announce_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/connection_pool/shared_timed_stack_spec.rb'
- 'spec/lib/delivery_failure_tracker_spec.rb' - 'spec/lib/delivery_failure_tracker_spec.rb'
- 'spec/lib/emoji_formatter_spec.rb' - 'spec/lib/emoji_formatter_spec.rb'
- 'spec/lib/entity_cache_spec.rb'
- 'spec/lib/fast_ip_map_spec.rb' - 'spec/lib/fast_ip_map_spec.rb'
- 'spec/lib/feed_manager_spec.rb' - 'spec/lib/feed_manager_spec.rb'
- 'spec/lib/hashtag_normalizer_spec.rb' - 'spec/lib/hashtag_normalizer_spec.rb'
- 'spec/lib/html_aware_formatter_spec.rb'
- 'spec/lib/link_details_extractor_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_pool_spec.rb'
- 'spec/lib/request_spec.rb' - 'spec/lib/request_spec.rb'
- 'spec/lib/sanitize_config_spec.rb' - 'spec/lib/sanitize_config_spec.rb'
- 'spec/lib/status_finder_spec.rb' - 'spec/lib/status_finder_spec.rb'
- 'spec/lib/status_reach_finder_spec.rb' - 'spec/lib/status_reach_finder_spec.rb'
- 'spec/lib/suspicious_sign_in_detector_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/access_tokens_vacuum_spec.rb'
- 'spec/lib/vacuum/backups_vacuum_spec.rb' - 'spec/lib/vacuum/backups_vacuum_spec.rb'
- 'spec/lib/vacuum/feeds_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/canonical_email_block_spec.rb'
- 'spec/models/concerns/account_interactions_spec.rb' - 'spec/models/concerns/account_interactions_spec.rb'
- 'spec/models/custom_emoji_filter_spec.rb' - 'spec/models/custom_emoji_filter_spec.rb'
- 'spec/models/custom_emoji_spec.rb'
- 'spec/models/follow_spec.rb' - 'spec/models/follow_spec.rb'
- 'spec/models/home_feed_spec.rb' - 'spec/models/home_feed_spec.rb'
- 'spec/models/media_attachment_spec.rb'
- 'spec/models/notification_spec.rb' - 'spec/models/notification_spec.rb'
- 'spec/models/public_feed_spec.rb' - 'spec/models/public_feed_spec.rb'
- 'spec/models/relationship_filter_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/status_spec.rb'
- 'spec/models/tag_spec.rb' - 'spec/models/tag_spec.rb'
- 'spec/models/trends/statuses_spec.rb' - 'spec/models/trends/statuses_spec.rb'
@ -2347,46 +2332,25 @@ Style/FormatStringToken:
Style/FrozenStringLiteralComment: Style/FrozenStringLiteralComment:
Enabled: false Enabled: false
# Offense count: 69 # Offense count: 34
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
Style/GuardClause: Style/GuardClause:
Exclude: Exclude:
- 'app/controllers/admin/confirmations_controller.rb' - '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/confirmations_controller.rb'
- 'app/controllers/auth/passwords_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/controllers/settings/two_factor_authentication/webauthn_credentials_controller.rb'
- 'app/lib/activitypub/activity/block.rb' - 'app/lib/activitypub/activity/block.rb'
- 'app/lib/activitypub/linked_data_signature.rb'
- 'app/lib/connection_pool/shared_connection_pool.rb' - 'app/lib/connection_pool/shared_connection_pool.rb'
- 'app/lib/request.rb' - 'app/lib/request.rb'
- 'app/lib/request_pool.rb' - 'app/lib/request_pool.rb'
- 'app/lib/status_finder.rb'
- 'app/lib/webfinger.rb' - 'app/lib/webfinger.rb'
- 'app/lib/webfinger_resource.rb' - 'app/lib/webfinger_resource.rb'
- 'app/models/account_statuses_cleanup_policy.rb'
- 'app/models/concerns/account_counters.rb' - 'app/models/concerns/account_counters.rb'
- 'app/models/concerns/ldap_authenticable.rb' - 'app/models/concerns/ldap_authenticable.rb'
- 'app/models/tag.rb' - 'app/models/tag.rb'
- 'app/models/user.rb' - 'app/models/user.rb'
- 'app/serializers/rest/instance_serializer.rb'
- 'app/services/fan_out_on_write_service.rb' - 'app/services/fan_out_on_write_service.rb'
- 'app/services/post_status_service.rb' - 'app/services/post_status_service.rb'
- 'app/services/process_hashtags_service.rb' - 'app/services/process_hashtags_service.rb'

View File

@ -65,7 +65,6 @@ class InitialStateSerializer < ActiveModel::Serializer
store store
end end
# rubocop:enable Metrics/AbcSize
def compose def compose
store = {} store = {}

View File

@ -83,7 +83,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Admin') } let(:target_role) { UserRole.find_by(name: 'Admin') }
it 'fails to memorialize account' do 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 expect(account.reload).to_not be_memorial
end end
end end
@ -92,7 +92,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Moderator') } let(:target_role) { UserRole.find_by(name: 'Moderator') }
it 'succeeds in memorializing account' do 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 expect(account.reload).to be_memorial
end end
end end
@ -105,7 +105,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Admin') } let(:target_role) { UserRole.find_by(name: 'Admin') }
it 'fails to memorialize account' do 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 expect(account.reload).to_not be_memorial
end end
end end
@ -114,7 +114,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Moderator') } let(:target_role) { UserRole.find_by(name: 'Moderator') }
it 'fails to memorialize account' do 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 expect(account.reload).to_not be_memorial
end end
end end
@ -132,7 +132,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') } let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in enabling account' do 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 expect(user.reload).to_not be_disabled
end end
end end
@ -141,7 +141,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone } let(:role) { UserRole.everyone }
it 'fails to enable account' do 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 expect(user.reload).to be_disabled
end end
end end
@ -162,12 +162,12 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') } let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in approving account' do 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 expect(user.reload).to be_approved
end end
it 'logs action' do it 'logs action' do
is_expected.to have_http_status 302 expect(subject).to have_http_status 302
log_item = Admin::ActionLog.last log_item = Admin::ActionLog.last
@ -182,7 +182,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone } let(:role) { UserRole.everyone }
it 'fails to approve account' do 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 expect(user.reload).to_not be_approved
end end
end end
@ -203,11 +203,11 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') } let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in rejecting account' do 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 end
it 'logs action' do it 'logs action' do
is_expected.to have_http_status 302 expect(subject).to have_http_status 302
log_item = Admin::ActionLog.last log_item = Admin::ActionLog.last
@ -222,7 +222,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone } let(:role) { UserRole.everyone }
it 'fails to reject account' do 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 expect(user.reload).to_not be_approved
end end
end end
@ -242,7 +242,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') } let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in redownloading' do 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
end end
@ -250,7 +250,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone } let(:role) { UserRole.everyone }
it 'fails to redownload' do it 'fails to redownload' do
is_expected.to have_http_status 403 expect(subject).to have_http_status 403
end end
end end
end end
@ -265,7 +265,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') } let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in removing avatar' do 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
end end
@ -273,7 +273,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone } let(:role) { UserRole.everyone }
it 'fails to remove avatar' do it 'fails to remove avatar' do
is_expected.to have_http_status 403 expect(subject).to have_http_status 403
end end
end end
end end

View File

@ -42,7 +42,7 @@ RSpec.describe Admin::InstancesController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') } let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in purging instance' do it 'succeeds in purging instance' do
is_expected.to redirect_to admin_instances_path expect(subject).to redirect_to admin_instances_path
end end
end end
@ -50,7 +50,7 @@ RSpec.describe Admin::InstancesController, type: :controller do
let(:role) { nil } let(:role) { nil }
it 'fails to purge instance' do it 'fails to purge instance' do
is_expected.to have_http_status 403 expect(subject).to have_http_status 403
end end
end end
end end

View File

@ -28,7 +28,7 @@ describe ApplicationController, type: :controller do
end end
it 'renders template for http' do 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
end end

View File

@ -9,7 +9,7 @@ RSpec.describe HomeController, type: :controller do
context 'when not signed in' do context 'when not signed in' do
it 'returns http success' do it 'returns http success' do
@request.path = '/' @request.path = '/'
is_expected.to have_http_status(:success) expect(subject).to have_http_status(:success)
end end
end end
@ -21,7 +21,7 @@ RSpec.describe HomeController, type: :controller do
end end
it 'returns http success' do it 'returns http success' do
is_expected.to have_http_status(:success) expect(subject).to have_http_status(:success)
end end
end end
end end

View File

@ -7,7 +7,7 @@ describe RelationshipsController do
shared_examples 'authenticate user' do shared_examples 'authenticate user' do
it 'redirects when not signed in' 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
end end

View File

@ -5,7 +5,7 @@ describe Settings::FeaturedTagsController do
shared_examples 'authenticate user' do shared_examples 'authenticate user' do
it 'redirects to sign_in page' 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
end end

View File

@ -5,7 +5,7 @@ describe Settings::MigrationsController do
shared_examples 'authenticate user' do shared_examples 'authenticate user' do
it 'redirects to sign_in page' 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
end end
@ -27,8 +27,8 @@ describe Settings::MigrationsController do
let(:moved_to_account) { nil } let(:moved_to_account) { nil }
it 'renders show page' do it 'renders show page' do
is_expected.to have_http_status 200 expect(subject).to have_http_status 200
is_expected.to render_template :show expect(subject).to render_template :show
end end
end end
@ -36,8 +36,8 @@ describe Settings::MigrationsController do
let(:moved_to_account) { Fabricate(:account) } let(:moved_to_account) { Fabricate(:account) }
it 'renders show page' do it 'renders show page' do
is_expected.to have_http_status 200 expect(subject).to have_http_status 200
is_expected.to render_template :show expect(subject).to render_template :show
end end
end 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)]) } let(:acct) { Fabricate(:account, also_known_as: [ActivityPub::TagManager.instance.uri_for(user.account)]) }
it 'updates moved to account' do 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 expect(user.account.reload.moved_to_account_id).to eq acct.id
end end
end end
@ -70,7 +70,7 @@ describe Settings::MigrationsController do
let(:acct) { user.account } let(:acct) { user.account }
it 'renders show' do it 'renders show' do
is_expected.to render_template :show expect(subject).to render_template :show
end end
it 'does not update the moved account' do it 'does not update the moved account' do
@ -82,7 +82,7 @@ describe Settings::MigrationsController do
let(:acct) { Fabricate(:account, also_known_as: []) } let(:acct) { Fabricate(:account, also_known_as: []) }
it 'renders show' do it 'renders show' do
is_expected.to render_template :show expect(subject).to render_template :show
end end
it 'does not update the moved account' do it 'does not update the moved account' do
@ -99,7 +99,7 @@ describe Settings::MigrationsController do
end end
it 'renders show' do it 'renders show' do
is_expected.to render_template :show expect(subject).to render_template :show
end end
it 'does not update the moved account' do it 'does not update the moved account' do

View File

@ -15,7 +15,7 @@ describe Settings::SessionsController do
let(:id) { session_activation.id } let(:id) { session_activation.id }
it 'destroys session activation' do 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 expect(SessionActivation.find_by(id: id)).to be_nil
end end
end end
@ -24,7 +24,7 @@ describe Settings::SessionsController do
let(:id) { session_activation.id + 1000 } let(:id) { session_activation.id + 1000 }
it 'destroys session activation' do it 'destroys session activation' do
is_expected.to have_http_status 404 expect(subject).to have_http_status 404
end end
end end
end end

View File

@ -21,7 +21,7 @@ describe 'Log in' do
fill_in 'user_password', with: password fill_in 'user_password', with: password
click_on I18n.t('auth.login') click_on I18n.t('auth.login')
is_expected.to have_css('div.app-holder') expect(subject).to have_css('div.app-holder')
end end
it 'A invalid email and password user is not able to log in' do 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' fill_in 'user_password', with: 'invalid_password'
click_on I18n.t('auth.login') 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 end
context do context do
@ -40,7 +40,7 @@ describe 'Log in' do
fill_in 'user_password', with: password fill_in 'user_password', with: password
click_on I18n.t('auth.login') click_on I18n.t('auth.login')
is_expected.to have_css('div.admin-wrapper') expect(subject).to have_css('div.admin-wrapper')
end end
end end

View File

@ -17,7 +17,7 @@ describe 'Profile' do
it 'I can view Annes public account' do it 'I can view Annes public account' do
visit account_path('alice') visit account_path('alice')
is_expected.to have_title("alice (@alice@#{local_domain})") expect(subject).to have_title("alice (@alice@#{local_domain})")
end end
it 'I can change my account' do it 'I can change my account' do
@ -28,6 +28,6 @@ describe 'Profile' do
first('button[type=submit]').click first('button[type=submit]').click
is_expected.to have_content 'Changes successfully saved!' expect(subject).to have_content 'Changes successfully saved!'
end end
end end

View File

@ -24,7 +24,7 @@ RSpec.describe EmojiFormatter do
let(:text) { preformat_text(':coolcat: Beep boop') } let(:text) { preformat_text(':coolcat: Beep boop') }
it 'converts the shortcode to an image tag' do it 'converts the shortcode to an image tag' do
is_expected.to match(/<img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/) expect(subject).to match(/<img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
end end
end end
@ -32,7 +32,7 @@ RSpec.describe EmojiFormatter do
let(:text) { preformat_text('Beep :coolcat: boop') } let(:text) { preformat_text('Beep :coolcat: boop') }
it 'converts the shortcode to an image tag' do it 'converts the shortcode to an image tag' do
is_expected.to match(/Beep <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/) expect(subject).to match(/Beep <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
end end
end end
@ -40,7 +40,7 @@ RSpec.describe EmojiFormatter do
let(:text) { preformat_text(':coolcat::coolcat:') } let(:text) { preformat_text(':coolcat::coolcat:') }
it 'does not touch the shortcodes' do it 'does not touch the shortcodes' do
is_expected.to match(/:coolcat::coolcat:/) expect(subject).to match(/:coolcat::coolcat:/)
end end
end end
@ -48,7 +48,7 @@ RSpec.describe EmojiFormatter do
let(:text) { preformat_text('Beep boop :coolcat:') } let(:text) { preformat_text('Beep boop :coolcat:') }
it 'converts the shortcode to an image tag' do it 'converts the shortcode to an image tag' do
is_expected.to match(/boop <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/) expect(subject).to match(/boop <img rel="emoji" draggable="false" width="16" height="16" class="emojione custom-emoji" alt=":coolcat:"/)
end end
end end
end end

View File

@ -12,7 +12,7 @@ RSpec.describe EntityCache do
let(:domain) { 'example.org' } let(:domain) { 'example.org' }
it 'returns an empty array' do it 'returns an empty array' do
is_expected.to eq [] expect(subject).to eq []
end end
end end
end end

View File

@ -9,7 +9,7 @@ RSpec.describe HtmlAwareFormatter do
let(:text) { 'Foo bar' } let(:text) { 'Foo bar' }
it 'returns formatted text' do it 'returns formatted text' do
is_expected.to eq '<p>Foo bar</p>' expect(subject).to eq '<p>Foo bar</p>'
end end
end end
@ -20,7 +20,7 @@ RSpec.describe HtmlAwareFormatter do
let(:text) { 'Beep boop' } let(:text) { 'Beep boop' }
it 'keeps the plain text' do it 'keeps the plain text' do
is_expected.to include 'Beep boop' expect(subject).to include 'Beep boop'
end end
end end
@ -28,7 +28,7 @@ RSpec.describe HtmlAwareFormatter do
let(:text) { '<script>alert("Hello")</script>' } let(:text) { '<script>alert("Hello")</script>' }
it 'strips the scripts' do it 'strips the scripts' do
is_expected.to_not include '<script>alert("Hello")</script>' expect(subject).to_not include '<script>alert("Hello")</script>'
end end
end end
@ -36,7 +36,7 @@ RSpec.describe HtmlAwareFormatter do
let(:text) { '<span class="mention status__content__spoiler-link">Show more</span>' } let(:text) { '<span class="mention status__content__spoiler-link">Show more</span>' }
it 'strips the malicious classes' do 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 end
end end

View File

@ -45,7 +45,7 @@ describe OStatus::TagManager do
it 'returns the unique tag for status' do it 'returns the unique tag for status' do
expect(target.object_type).to eq :comment expect(target.object_type).to eq :comment
is_expected.to eq target.uri expect(subject).to eq target.uri
end end
end end
@ -54,7 +54,7 @@ describe OStatus::TagManager do
it 'returns the unique tag for status' do it 'returns the unique tag for status' do
expect(target.object_type).to eq :note expect(target.object_type).to eq :note
is_expected.to eq target.uri expect(subject).to eq target.uri
end end
end end
@ -63,7 +63,7 @@ describe OStatus::TagManager do
it 'returns the URL for account' do it 'returns the URL for account' do
expect(target.object_type).to eq :person 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 end
end end

View File

@ -8,7 +8,7 @@ RSpec.describe PlainTextFormatter do
let(:status) { Fabricate(:status, text: '<p>a text by a nerd who uses an HTML tag in text</p>', uri: nil) } let(:status) { Fabricate(:status, text: '<p>a text by a nerd who uses an HTML tag in text</p>', uri: nil) }
it 'returns the raw text' do it 'returns the raw text' do
is_expected.to eq '<p>a text by a nerd who uses an HTML tag in text</p>' expect(subject).to eq '<p>a text by a nerd who uses an HTML tag in text</p>'
end end
end end
@ -17,7 +17,7 @@ RSpec.describe PlainTextFormatter do
let(:status) { Fabricate(:status, account: remote_account, text: '<p>Hello</p><script>alert("Hello")</script>') } let(:status) { Fabricate(:status, account: remote_account, text: '<p>Hello</p><script>alert("Hello")</script>') }
it 'returns tag-stripped text' do it 'returns tag-stripped text' do
is_expected.to eq 'Hello' expect(subject).to eq 'Hello'
end end
end end
end end

View File

@ -10,7 +10,7 @@ RSpec.describe TextFormatter do
let(:text) { 'text' } let(:text) { 'text' }
it 'paragraphizes the text' do it 'paragraphizes the text' do
is_expected.to eq '<p>text</p>' expect(subject).to eq '<p>text</p>'
end end
end end
@ -18,7 +18,7 @@ RSpec.describe TextFormatter do
let(:text) { "line\nfeed" } let(:text) { "line\nfeed" }
it 'removes line feeds' do it 'removes line feeds' do
is_expected.to_not include "\n" expect(subject).to_not include "\n"
end end
end end
@ -27,7 +27,7 @@ RSpec.describe TextFormatter do
let(:text) { '@alice' } let(:text) { '@alice' }
it 'creates a mention link' do it 'creates a mention link' do
is_expected.to include '<a href="https://cb6e6126.ngrok.io/@alice" class="u-url mention">@<span>alice</span></a></span>' expect(subject).to include '<a href="https://cb6e6126.ngrok.io/@alice" class="u-url mention">@<span>alice</span></a></span>'
end end
end end
@ -36,7 +36,7 @@ RSpec.describe TextFormatter do
let(:text) { '@alice' } let(:text) { '@alice' }
it 'does not create a mention link' do it 'does not create a mention link' do
is_expected.to include '@alice' expect(subject).to include '@alice'
end end
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' } let(:text) { 'https://hackernoon.com/the-power-to-build-communities-a-response-to-mark-zuckerberg-3f2cac9148a4' }
it 'matches the full URL' do 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
end end
@ -52,7 +52,7 @@ RSpec.describe TextFormatter do
let(:text) { 'http://google.com' } let(:text) { 'http://google.com' }
it 'matches the full URL' do it 'matches the full URL' do
is_expected.to include 'href="http://google.com"' expect(subject).to include 'href="http://google.com"'
end end
end end
@ -60,7 +60,7 @@ RSpec.describe TextFormatter do
let(:text) { 'http://example.gay' } let(:text) { 'http://example.gay' }
it 'matches the full URL' do it 'matches the full URL' do
is_expected.to include 'href="http://example.gay"' expect(subject).to include 'href="http://example.gay"'
end end
end end
@ -68,11 +68,11 @@ RSpec.describe TextFormatter do
let(:text) { 'https://nic.みんな/' } let(:text) { 'https://nic.みんな/' }
it 'matches the full URL' do it 'matches the full URL' do
is_expected.to include 'href="https://nic.みんな/"' expect(subject).to include 'href="https://nic.みんな/"'
end end
it 'has display URL' do it 'has display URL' do
is_expected.to include '<span class="">nic.みんな/</span>' expect(subject).to include '<span class="">nic.みんな/</span>'
end end
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. ' } 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 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
end end
@ -88,7 +88,7 @@ RSpec.describe TextFormatter do
let(:text) { '(http://google.com/)' } let(:text) { '(http://google.com/)' }
it 'matches the full URL but not the parentheses' do 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
end end
@ -96,7 +96,7 @@ RSpec.describe TextFormatter do
let(:text) { 'http://www.google.com!' } let(:text) { 'http://www.google.com!' }
it 'matches the full URL but not the exclamation point' do 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
end end
@ -104,7 +104,7 @@ RSpec.describe TextFormatter do
let(:text) { "http://www.google.com'" } let(:text) { "http://www.google.com'" }
it 'matches the full URL but not the single quote' do 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
end end
@ -112,7 +112,7 @@ RSpec.describe TextFormatter do
let(:text) { 'http://www.google.com>' } let(:text) { 'http://www.google.com>' }
it 'matches the full URL but not the angle bracket' do 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
end end
@ -121,7 +121,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=autolink' } let(:text) { 'https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=autolink' }
it 'matches the full URL' do it 'matches the full URL' do
is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;q=autolink"' expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;q=autolink"'
end end
end end
@ -129,7 +129,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓&q=autolink' } let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓&q=autolink' }
it 'matches the full URL' do it 'matches the full URL' do
is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=✓&amp;q=autolink"' expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=✓&amp;q=autolink"'
end end
end end
@ -137,7 +137,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓' } let(:text) { 'https://www.ruby-toolbox.com/search?utf8=✓' }
it 'matches the full URL' do 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
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' } let(:text) { 'https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&utf81=✓&q=autolink' }
it 'preserves escaped unicode characters' do it 'preserves escaped unicode characters' do
is_expected.to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;utf81=✓&amp;q=autolink"' expect(subject).to include 'href="https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&amp;utf81=✓&amp;q=autolink"'
end end
end end
end end
@ -154,7 +154,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://en.wikipedia.org/wiki/Diaspora_(software)' } let(:text) { 'https://en.wikipedia.org/wiki/Diaspora_(software)' }
it 'matches the full URL' do 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
end end
@ -162,7 +162,7 @@ RSpec.describe TextFormatter do
let(:text) { '"https://example.com/"' } let(:text) { '"https://example.com/"' }
it 'does not match the quotation marks' do 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
end end
@ -170,7 +170,7 @@ RSpec.describe TextFormatter do
let(:text) { '<https://example.com/>' } let(:text) { '<https://example.com/>' }
it 'does not match the angle brackets' do 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
end end
@ -178,7 +178,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://ja.wikipedia.org/wiki/日本' } let(:text) { 'https://ja.wikipedia.org/wiki/日本' }
it 'matches the full URL' do 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
end end
@ -186,7 +186,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://ko.wikipedia.org/wiki/대한민국' } let(:text) { 'https://ko.wikipedia.org/wiki/대한민국' }
it 'matches the full URL' do 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
end end
@ -194,7 +194,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://example.com/ abc123' } let(:text) { 'https://example.com/ abc123' }
it 'does not match the full-width space' do 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
end end
@ -202,7 +202,7 @@ RSpec.describe TextFormatter do
let(:text) { '「[https://example.org/」' } let(:text) { '「[https://example.org/」' }
it 'does not match the quotation marks' do 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
end end
@ -210,7 +210,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://baike.baidu.com/item/中华人民共和国' } let(:text) { 'https://baike.baidu.com/item/中华人民共和国' }
it 'matches the full URL' do 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
end end
@ -218,7 +218,7 @@ RSpec.describe TextFormatter do
let(:text) { 'https://zh.wikipedia.org/wiki/臺灣' } let(:text) { 'https://zh.wikipedia.org/wiki/臺灣' }
it 'matches the full URL' do 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
end end
@ -226,11 +226,11 @@ RSpec.describe TextFormatter do
let(:text) { 'http://example.com/b<del>b</del>' } let(:text) { 'http://example.com/b<del>b</del>' }
it 'does not include the HTML in the URL' do 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 end
it 'escapes the HTML' do it 'escapes the HTML' do
is_expected.to include '&lt;del&gt;b&lt;/del&gt;' expect(subject).to include '&lt;del&gt;b&lt;/del&gt;'
end end
end end
@ -238,11 +238,11 @@ RSpec.describe TextFormatter do
let(:text) { 'http://example.com/blahblahblahblah/a<script>alert("Hello")</script>' } let(:text) { 'http://example.com/blahblahblahblah/a<script>alert("Hello")</script>' }
it 'does not include the HTML in the URL' do 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 end
it 'escapes the HTML' do it 'escapes the HTML' do
is_expected.to include '&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;' expect(subject).to include '&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;'
end end
end end
@ -250,7 +250,7 @@ RSpec.describe TextFormatter do
let(:text) { '<script>alert("Hello")</script>' } let(:text) { '<script>alert("Hello")</script>' }
it 'escapes the HTML' do it 'escapes the HTML' do
is_expected.to include '<p>&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;</p>' expect(subject).to include '<p>&lt;script&gt;alert(&quot;Hello&quot;)&lt;/script&gt;</p>'
end end
end end
@ -258,7 +258,7 @@ RSpec.describe TextFormatter do
let(:text) { %q{<img src="javascript:alert('XSS');">} } let(:text) { %q{<img src="javascript:alert('XSS');">} }
it 'escapes the HTML' do it 'escapes the HTML' do
is_expected.to include '<p>&lt;img src=&quot;javascript:alert(&#39;XSS&#39;);&quot;&gt;</p>' expect(subject).to include '<p>&lt;img src=&quot;javascript:alert(&#39;XSS&#39;);&quot;&gt;</p>'
end end
end end
@ -266,7 +266,7 @@ RSpec.describe TextFormatter do
let(:text) { 'http://www\.google\.com' } let(:text) { 'http://www\.google\.com' }
it 'outputs the raw URL' do it 'outputs the raw URL' do
is_expected.to eq '<p>http://www\.google\.com</p>' expect(subject).to eq '<p>http://www\.google\.com</p>'
end end
end end
@ -274,7 +274,7 @@ RSpec.describe TextFormatter do
let(:text) { '#hashtag' } let(:text) { '#hashtag' }
it 'creates a hashtag link' do it 'creates a hashtag link' do
is_expected.to include '/tags/hashtag" class="mention hashtag" rel="tag">#<span>hashtag</span></a>' expect(subject).to include '/tags/hashtag" class="mention hashtag" rel="tag">#<span>hashtag</span></a>'
end end
end end
@ -282,7 +282,7 @@ RSpec.describe TextFormatter do
let(:text) { '#hashtagタグ' } let(:text) { '#hashtagタグ' }
it 'creates a hashtag link' do it 'creates a hashtag link' do
is_expected.to include '/tags/hashtag%E3%82%BF%E3%82%B0" class="mention hashtag" rel="tag">#<span>hashtagタグ</span></a>' expect(subject).to include '/tags/hashtag%E3%82%BF%E3%82%B0" class="mention hashtag" rel="tag">#<span>hashtagタグ</span></a>'
end end
end end
@ -290,7 +290,7 @@ RSpec.describe TextFormatter do
let(:text) { 'xmpp:user@instance.com' } let(:text) { 'xmpp:user@instance.com' }
it 'matches the full URI' do 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
end end
@ -298,7 +298,7 @@ RSpec.describe TextFormatter do
let(:text) { 'please join xmpp:muc@instance.com?join right now' } let(:text) { 'please join xmpp:muc@instance.com?join right now' }
it 'matches the full URI' do 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
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' } let(:text) { 'wikipedia gives this example of a magnet uri: magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a' }
it 'matches the full URI' do 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 end
end end

View File

@ -14,13 +14,13 @@ describe AccountInteractions do
context 'account with Follow' do context 'account with Follow' do
it 'returns { target_account_id => true }' do it 'returns { target_account_id => true }' do
Fabricate(:follow, account: account, target_account: target_account) 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
end end
context 'account without Follow' do context 'account without Follow' do
it 'returns {}' do it 'returns {}' do
is_expected.to eq({}) expect(subject).to eq({})
end end
end end
end end
@ -31,13 +31,13 @@ describe AccountInteractions do
context 'account with Follow' do context 'account with Follow' do
it 'returns { target_account_id => true }' do it 'returns { target_account_id => true }' do
Fabricate(:follow, account: target_account, target_account: account) 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
end end
context 'account without Follow' do context 'account without Follow' do
it 'returns {}' do it 'returns {}' do
is_expected.to eq({}) expect(subject).to eq({})
end end
end end
end end
@ -48,13 +48,13 @@ describe AccountInteractions do
context 'account with Block' do context 'account with Block' do
it 'returns { target_account_id => true }' do it 'returns { target_account_id => true }' do
Fabricate(:block, account: account, target_account: target_account) 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
end end
context 'account without Block' do context 'account without Block' do
it 'returns {}' do it 'returns {}' do
is_expected.to eq({}) expect(subject).to eq({})
end end
end end
end end
@ -71,7 +71,7 @@ describe AccountInteractions do
let(:hide) { true } let(:hide) { true }
it 'returns { target_account_id => { notifications: true } }' do 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
end end
@ -79,14 +79,14 @@ describe AccountInteractions do
let(:hide) { false } let(:hide) { false }
it 'returns { target_account_id => { notifications: false } }' do 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 end
end end
context 'account without Mute' do context 'account without Mute' do
it 'returns {}' do it 'returns {}' do
is_expected.to eq({}) expect(subject).to eq({})
end end
end end
end end
@ -231,7 +231,7 @@ describe AccountInteractions do
it 'creates and returns ConversationMute' do it 'creates and returns ConversationMute' do
expect 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.to change { account.conversation_mutes.count }.by 1
end end
end end
@ -243,7 +243,7 @@ describe AccountInteractions do
it 'creates and returns AccountDomainBlock' do it 'creates and returns AccountDomainBlock' do
expect 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.to change { account.domain_blocks.count }.by 1
end end
end end
@ -254,14 +254,14 @@ describe AccountInteractions do
context 'following target_account' do context 'following target_account' do
it 'returns destroyed Follow' do it 'returns destroyed Follow' do
account.active_relationships.create(target_account: target_account) 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 expect(subject).to be_destroyed
end end
end end
context 'not following target_account' do context 'not following target_account' do
it 'returns nil' do it 'returns nil' do
is_expected.to be_nil expect(subject).to be_nil
end end
end end
end end
@ -272,14 +272,14 @@ describe AccountInteractions do
context 'blocking target_account' do context 'blocking target_account' do
it 'returns destroyed Block' do it 'returns destroyed Block' do
account.block_relationships.create(target_account: target_account) 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 expect(subject).to be_destroyed
end end
end end
context 'not blocking target_account' do context 'not blocking target_account' do
it 'returns nil' do it 'returns nil' do
is_expected.to be_nil expect(subject).to be_nil
end end
end end
end end
@ -290,14 +290,14 @@ describe AccountInteractions do
context 'muting target_account' do context 'muting target_account' do
it 'returns destroyed Mute' do it 'returns destroyed Mute' do
account.mute_relationships.create(target_account: target_account) 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 expect(subject).to be_destroyed
end end
end end
context 'not muting target_account' do context 'not muting target_account' do
it 'returns nil' do it 'returns nil' do
is_expected.to be_nil expect(subject).to be_nil
end end
end end
end end
@ -310,14 +310,14 @@ describe AccountInteractions do
context 'muting the conversation' do context 'muting the conversation' do
it 'returns destroyed ConversationMute' do it 'returns destroyed ConversationMute' do
account.conversation_mutes.create(conversation: conversation) account.conversation_mutes.create(conversation: conversation)
is_expected.to be_a ConversationMute expect(subject).to be_a ConversationMute
expect(subject).to be_destroyed expect(subject).to be_destroyed
end end
end end
context 'not muting the conversation' do context 'not muting the conversation' do
it 'returns nil' do it 'returns nil' do
is_expected.to be_nil expect(subject).to be_nil
end end
end end
end end
@ -331,14 +331,14 @@ describe AccountInteractions do
it 'returns destroyed AccountDomainBlock' do it 'returns destroyed AccountDomainBlock' do
account_domain_block = Fabricate(:account_domain_block, domain: domain) account_domain_block = Fabricate(:account_domain_block, domain: domain)
account.domain_blocks << account_domain_block account.domain_blocks << account_domain_block
is_expected.to be_a AccountDomainBlock expect(subject).to be_a AccountDomainBlock
expect(subject).to be_destroyed expect(subject).to be_destroyed
end end
end end
context 'unblocking the domain' do context 'unblocking the domain' do
it 'returns nil' do it 'returns nil' do
is_expected.to be_nil expect(subject).to be_nil
end end
end end
end end
@ -349,13 +349,13 @@ describe AccountInteractions do
context 'following target_account' do context 'following target_account' do
it 'returns true' do it 'returns true' do
account.active_relationships.create(target_account: target_account) account.active_relationships.create(target_account: target_account)
is_expected.to be true expect(subject).to be true
end end
end end
context 'not following target_account' do context 'not following target_account' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -366,13 +366,13 @@ describe AccountInteractions do
context 'followed by target_account' do context 'followed by target_account' do
it 'returns true' do it 'returns true' do
account.passive_relationships.create(account: target_account) account.passive_relationships.create(account: target_account)
is_expected.to be true expect(subject).to be true
end end
end end
context 'not followed by target_account' do context 'not followed by target_account' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -383,13 +383,13 @@ describe AccountInteractions do
context 'blocking target_account' do context 'blocking target_account' do
it 'returns true' do it 'returns true' do
account.block_relationships.create(target_account: target_account) account.block_relationships.create(target_account: target_account)
is_expected.to be true expect(subject).to be true
end end
end end
context 'not blocking target_account' do context 'not blocking target_account' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -403,13 +403,13 @@ describe AccountInteractions do
it 'returns true' do it 'returns true' do
account_domain_block = Fabricate(:account_domain_block, domain: domain) account_domain_block = Fabricate(:account_domain_block, domain: domain)
account.domain_blocks << account_domain_block account.domain_blocks << account_domain_block
is_expected.to be true expect(subject).to be true
end end
end end
context 'not blocking the domain' do context 'not blocking the domain' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -421,13 +421,13 @@ describe AccountInteractions do
it 'returns true' do it 'returns true' do
mute = Fabricate(:mute, account: account, target_account: target_account) mute = Fabricate(:mute, account: account, target_account: target_account)
account.mute_relationships << mute account.mute_relationships << mute
is_expected.to be true expect(subject).to be true
end end
end end
context 'not muting target_account' do context 'not muting target_account' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -440,13 +440,13 @@ describe AccountInteractions do
context 'muting the conversation' do context 'muting the conversation' do
it 'returns true' do it 'returns true' do
account.conversation_mutes.create(conversation: conversation) account.conversation_mutes.create(conversation: conversation)
is_expected.to be true expect(subject).to be true
end end
end end
context 'not muting the conversation' do context 'not muting the conversation' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -463,7 +463,7 @@ describe AccountInteractions do
let(:hide) { true } let(:hide) { true }
it 'returns true' do it 'returns true' do
is_expected.to be true expect(subject).to be true
end end
end end
@ -471,7 +471,7 @@ describe AccountInteractions do
let(:hide) { false } let(:hide) { false }
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -482,13 +482,13 @@ describe AccountInteractions do
context 'requested by target_account' do context 'requested by target_account' do
it 'returns true' do it 'returns true' do
Fabricate(:follow_request, account: account, target_account: target_account) Fabricate(:follow_request, account: account, target_account: target_account)
is_expected.to be true expect(subject).to be true
end end
end end
context 'not requested by target_account' do context 'not requested by target_account' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -502,7 +502,7 @@ describe AccountInteractions do
let(:favourites) { [Fabricate(:favourite, account: account)] } let(:favourites) { [Fabricate(:favourite, account: account)] }
it 'returns true' do it 'returns true' do
is_expected.to be true expect(subject).to be true
end end
end end
@ -510,7 +510,7 @@ describe AccountInteractions do
let(:favourites) { [] } let(:favourites) { [] }
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -524,7 +524,7 @@ describe AccountInteractions do
let(:reblogs) { [Fabricate(:status, account: account)] } let(:reblogs) { [Fabricate(:status, account: account)] }
it 'returns true' do it 'returns true' do
is_expected.to be true expect(subject).to be true
end end
end end
@ -532,7 +532,7 @@ describe AccountInteractions do
let(:reblogs) { [] } let(:reblogs) { [] }
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -545,13 +545,13 @@ describe AccountInteractions do
context 'pinned' do context 'pinned' do
it 'returns true' do it 'returns true' do
Fabricate(:status_pin, account: account, status: status) Fabricate(:status_pin, account: account, status: status)
is_expected.to be true expect(subject).to be true
end end
end end
context 'not pinned' do context 'not pinned' do
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end

View File

@ -11,7 +11,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:search_term) { 'blobpats' } let(:search_term) { 'blobpats' }
it 'finds emoji' do it 'finds emoji' do
is_expected.to include(custom_emoji) expect(subject).to include(custom_emoji)
end end
end end
@ -20,7 +20,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:search_term) { 'blob' } let(:search_term) { 'blob' }
it 'finds emoji' do it 'finds emoji' do
is_expected.to include(custom_emoji) expect(subject).to include(custom_emoji)
end end
end end
end end
@ -34,7 +34,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:domain) { nil } let(:domain) { nil }
it 'returns true' do it 'returns true' do
is_expected.to be true expect(subject).to be true
end end
end end
@ -42,7 +42,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:domain) { 'example.com' } let(:domain) { 'example.com' }
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -63,7 +63,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:text) { 'Hello :coolcat:' } let(:text) { 'Hello :coolcat:' }
it 'returns records used via shortcodes in text' do it 'returns records used via shortcodes in text' do
is_expected.to include(emojo) expect(subject).to include(emojo)
end end
end end
@ -71,7 +71,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:text) { '<p>Hello :coolcat:</p>' } let(:text) { '<p>Hello :coolcat:</p>' }
it 'returns records used via shortcodes in text' do it 'returns records used via shortcodes in text' do
is_expected.to include(emojo) expect(subject).to include(emojo)
end end
end end
end end

View File

@ -10,7 +10,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { '' } let(:remote_url) { '' }
it 'returns true' do it 'returns true' do
is_expected.to be true expect(subject).to be true
end end
end end
@ -18,7 +18,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' } let(:remote_url) { 'remote_url' }
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -35,7 +35,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' } let(:remote_url) { 'remote_url' }
it 'returns true' do it 'returns true' do
is_expected.to be true expect(subject).to be true
end end
end end
end end
@ -47,7 +47,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { '' } let(:remote_url) { '' }
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
@ -55,7 +55,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' } let(:remote_url) { 'remote_url' }
it 'returns true' do it 'returns true' do
is_expected.to be false expect(subject).to be false
end end
end end
end end

View File

@ -68,7 +68,7 @@ RSpec.describe Notification, type: :model do
let(:notifications) { [] } let(:notifications) { [] }
it 'returns []' do it 'returns []' do
is_expected.to eq [] expect(subject).to eq []
end end
end end

View File

@ -17,7 +17,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { { acct: 'gargron@quitter.no' } } let(:attrs) { { acct: 'gargron@quitter.no' } }
it 'returns acct' do it 'returns acct' do
is_expected.to eq 'gargron@quitter.no' expect(subject).to eq 'gargron@quitter.no'
end end
end end
@ -25,7 +25,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { {} } let(:attrs) { {} }
it do it do
is_expected.to be_nil expect(subject).to be_nil
end end
end end
end end
@ -37,7 +37,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { { acct: 'gargron@quitter.no' } } let(:attrs) { { acct: 'gargron@quitter.no' } }
it do it do
is_expected.to be true expect(subject).to be true
end end
end end
@ -45,7 +45,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { {} } let(:attrs) { {} }
it do it do
is_expected.to be false expect(subject).to be false
end end
end end
end end
@ -61,7 +61,7 @@ RSpec.describe RemoteFollow do
subject { remote_follow.subscribe_address_for(account) } subject { remote_follow.subscribe_address_for(account) }
it 'returns subscribe address' do 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 end
end end

View File

@ -33,7 +33,7 @@ describe Report do
end end
it 'assigns to a given account' do it 'assigns to a given account' do
is_expected.to eq current_account.id expect(subject).to eq current_account.id
end end
end end
@ -48,7 +48,7 @@ describe Report do
end end
it 'unassigns' do it 'unassigns' do
is_expected.to be_nil expect(subject).to be_nil
end end
end end

View File

@ -44,7 +44,7 @@ RSpec.describe SessionActivation, type: :model do
let(:id) { nil } let(:id) { nil }
it 'returns nil' do it 'returns nil' do
is_expected.to be_nil expect(subject).to be_nil
end end
end end
@ -54,7 +54,7 @@ RSpec.describe SessionActivation, type: :model do
context 'id exists as session_id' do context 'id exists as session_id' do
it 'returns true' do it 'returns true' do
is_expected.to be true expect(subject).to be true
end end
end end
@ -64,7 +64,7 @@ RSpec.describe SessionActivation, type: :model do
end end
it 'returns false' do it 'returns false' do
is_expected.to be false expect(subject).to be false
end end
end end
end end

View File

@ -173,7 +173,7 @@ RSpec.describe Setting, type: :model do
let(:enabled) { false } let(:enabled) { false }
it 'returns {}' do it 'returns {}' do
is_expected.to eq({}) expect(subject).to eq({})
end end
end end
@ -181,7 +181,7 @@ RSpec.describe Setting, type: :model do
let(:enabled) { true } let(:enabled) { true }
it 'returns instance of RailsSettings::Default' do it 'returns instance of RailsSettings::Default' do
is_expected.to be_a RailsSettings::Default expect(subject).to be_a RailsSettings::Default
end end
end end
end end