From 68b1071f8634de1c15877215df73a7c006aa6222 Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Fri, 17 Feb 2023 07:45:27 -0500
Subject: Autofix Rubocop RSpec/BeNil (#23653)
---
spec/models/concerns/account_interactions_spec.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'spec/models/concerns/account_interactions_spec.rb')
diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb
index 1d1898ab0..5cb4a83f7 100644
--- a/spec/models/concerns/account_interactions_spec.rb
+++ b/spec/models/concerns/account_interactions_spec.rb
@@ -317,7 +317,7 @@ describe AccountInteractions do
context 'not muting the conversation' do
it 'returns nil' do
- is_expected.to be nil
+ is_expected.to be_nil
end
end
end
--
cgit
From 669f6d2c0af969268c76e389ed626bce0cc9f998 Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Fri, 17 Feb 2023 16:56:20 -0500
Subject: Run rubocop formatting except line length (#23632)
---
.rubocop_todo.yml | 277 +--------------------
app/lib/activitypub/activity/create.rb | 4 +-
app/models/concerns/expireable.rb | 2 +-
app/services/activitypub/fetch_replies_service.rb | 2 +-
.../20161006213403_rails_settings_migration.rb | 10 +-
...uses_for_api_v1_accounts_account_id_statuses.rb | 8 +-
.../20190306145741_add_lock_version_to_polls.rb | 1 -
...20190807135426_add_comments_to_domain_blocks.rb | 1 -
...200312162302_add_status_ids_to_announcements.rb | 1 -
...00510181721_remove_duplicated_indexes_pghero.rb | 1 -
db/migrate/20200628133322_create_account_notes.rb | 1 -
...340_create_account_statuses_cleanup_policies.rb | 1 -
...0729171123_fix_custom_filter_keywords_id_seq.rb | 2 +-
lib/paperclip/attachment_extensions.rb | 10 +-
lib/tasks/mastodon.rake | 4 +-
spec/config/initializers/rack_attack_spec.rb | 10 +-
.../controllers/admin/dashboard_controller_spec.rb | 8 +-
.../api/v1/accounts/credentials_controller_spec.rb | 2 +-
spec/controllers/api/v1/reports_controller_spec.rb | 2 +-
.../favourited_by_accounts_controller_spec.rb | 2 +-
.../reblogged_by_accounts_controller_spec.rb | 2 +-
.../api/v2/filters/statuses_controller_spec.rb | 4 +-
spec/controllers/auth/sessions_controller_spec.rb | 6 +-
.../authorize_interactions_controller_spec.rb | 1 -
.../settings/applications_controller_spec.rb | 2 +-
.../confirmations_controller_spec.rb | 1 -
.../webauthn_credentials_controller_spec.rb | 2 +-
.../well_known/host_meta_controller_spec.rb | 12 +-
.../custom_filter_keyword_fabricator.rb | 2 +-
spec/fabricators/ip_block_fabricator.rb | 2 +-
spec/fabricators/poll_vote_fabricator.rb | 2 +-
spec/fabricators/status_edit_fabricator.rb | 2 +-
spec/fabricators/system_key_fabricator.rb | 1 -
spec/lib/activitypub/activity/create_spec.rb | 1 -
spec/lib/extractor_spec.rb | 8 +-
spec/lib/fast_ip_map_spec.rb | 2 +-
spec/lib/link_details_extractor_spec.rb | 124 ++++-----
spec/models/account/field_spec.rb | 4 +-
spec/models/account_alias_spec.rb | 1 -
.../models/account_statuses_cleanup_policy_spec.rb | 40 ++-
spec/models/concerns/account_interactions_spec.rb | 2 +-
spec/models/device_spec.rb | 1 -
spec/models/encrypted_message_spec.rb | 1 -
spec/models/export_spec.rb | 2 +-
spec/models/login_activity_spec.rb | 1 -
spec/models/one_time_key_spec.rb | 1 -
spec/models/system_key_spec.rb | 1 -
spec/models/trends/statuses_spec.rb | 2 +-
spec/models/user_role_spec.rb | 2 +-
spec/routing/api_routing_spec.rb | 72 +++---
spec/routing/well_known_routes_spec.rb | 8 +-
spec/serializers/rest/account_serializer_spec.rb | 2 +-
.../account_statuses_cleanup_service_spec.rb | 4 +-
.../fetch_remote_status_service_spec.rb | 2 +-
.../activitypub/process_account_service_spec.rb | 4 +-
.../activitypub/process_collection_service_spec.rb | 12 +-
.../process_status_update_service_spec.rb | 42 ++--
spec/services/bootstrap_timeline_service_spec.rb | 1 -
spec/services/fetch_oembed_service_spec.rb | 1 -
spec/services/import_service_spec.rb | 4 +-
spec/services/remove_from_follwers_service_spec.rb | 2 +-
spec/services/remove_status_service_spec.rb | 68 ++---
spec/services/resolve_account_service_spec.rb | 2 +-
spec/services/resolve_url_service_spec.rb | 2 +-
spec/services/update_status_service_spec.rb | 2 +-
spec/support/stories/profile_stories.rb | 4 +-
spec/validators/note_length_validator_spec.rb | 4 +-
.../unreserved_username_validator_spec.rb | 6 +-
.../activitypub/distribution_worker_spec.rb | 2 +-
.../activitypub/move_distribution_worker_spec.rb | 8 +-
.../accounts_statuses_cleanup_scheduler_spec.rb | 2 +-
71 files changed, 269 insertions(+), 566 deletions(-)
(limited to 'spec/models/concerns/account_interactions_spec.rb')
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index e3a42da5b..e24ce7e32 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 04:55:24 UTC using RuboCop version 1.45.1.
+# on 2023-02-16 05:53:07 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
@@ -14,53 +14,6 @@ Bundler/OrderedGems:
Exclude:
- 'Gemfile'
-# Offense count: 5
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, IndentationWidth.
-# SupportedStyles: with_first_argument, with_fixed_indentation
-Layout/ArgumentAlignment:
- Exclude:
- - 'spec/models/account_statuses_cleanup_policy_spec.rb'
- - 'spec/services/activitypub/process_collection_service_spec.rb'
- - 'spec/services/activitypub/process_status_update_service_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyleAlignWith.
-# SupportedStylesAlignWith: either, start_of_block, start_of_line
-Layout/BlockAlignment:
- Exclude:
- - 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-Layout/ClosingParenthesisIndentation:
- Exclude:
- - 'spec/controllers/auth/sessions_controller_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AllowForAlignment.
-Layout/CommentIndentation:
- Exclude:
- - 'db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb'
-
-# Offense count: 22
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: leading, trailing
-Layout/DotPosition:
- Exclude:
- - 'lib/paperclip/attachment_extensions.rb'
- - 'spec/routing/api_routing_spec.rb'
- - 'spec/routing/well_known_routes_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-Layout/ElseAlignment:
- Exclude:
- - 'db/migrate/20161006213403_rails_settings_migration.rb'
-
# Offense count: 81
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLineAfterGuardClause:
@@ -183,73 +136,6 @@ Layout/EmptyLineAfterMagicComment:
- 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb'
- 'spec/models/tag_spec.rb'
-# Offense count: 3
-# This cop supports safe autocorrection (--autocorrect).
-Layout/EmptyLines:
- Exclude:
- - 'spec/controllers/authorize_interactions_controller_spec.rb'
- - 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb'
- - 'spec/lib/activitypub/activity/create_spec.rb'
-
-# Offense count: 9
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: empty_lines, no_empty_lines
-Layout/EmptyLinesAroundBlockBody:
- Exclude:
- - 'spec/fabricators/system_key_fabricator.rb'
- - 'spec/models/account_alias_spec.rb'
- - 'spec/models/device_spec.rb'
- - 'spec/models/encrypted_message_spec.rb'
- - 'spec/models/login_activity_spec.rb'
- - 'spec/models/one_time_key_spec.rb'
- - 'spec/models/system_key_spec.rb'
- - 'spec/services/bootstrap_timeline_service_spec.rb'
- - 'spec/services/fetch_oembed_service_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyleAlignWith, Severity.
-# SupportedStylesAlignWith: keyword, variable, start_of_line
-Layout/EndAlignment:
- Exclude:
- - 'db/migrate/20161006213403_rails_settings_migration.rb'
-
-# Offense count: 19
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
-Layout/ExtraSpacing:
- Exclude:
- - 'spec/config/initializers/rack_attack_spec.rb'
- - 'spec/controllers/api/v2/filters/statuses_controller_spec.rb'
- - 'spec/fabricators/custom_filter_keyword_fabricator.rb'
- - 'spec/fabricators/poll_vote_fabricator.rb'
- - 'spec/models/account_statuses_cleanup_policy_spec.rb'
- - 'spec/services/activitypub/process_status_update_service_spec.rb'
- - 'spec/services/import_service_spec.rb'
- - 'spec/services/resolve_account_service_spec.rb'
- - 'spec/services/resolve_url_service_spec.rb'
- - 'spec/validators/note_length_validator_spec.rb'
- - 'spec/validators/unreserved_username_validator_spec.rb'
- - 'spec/workers/activitypub/move_distribution_worker_spec.rb'
-
-# Offense count: 4
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, IndentationWidth.
-# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
-Layout/FirstArgumentIndentation:
- Exclude:
- - 'spec/services/remove_status_service_spec.rb'
-
-# Offense count: 4
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, IndentationWidth.
-# SupportedStyles: special_inside_parentheses, consistent, align_brackets
-Layout/FirstArrayElementIndentation:
- Exclude:
- - 'spec/controllers/admin/dashboard_controller_spec.rb'
- - 'spec/workers/activitypub/move_distribution_worker_spec.rb'
-
# Offense count: 113
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
@@ -276,49 +162,6 @@ Layout/HashAlignment:
- 'spec/models/admin/account_action_spec.rb'
- 'spec/models/concerns/account_interactions_spec.rb'
-# Offense count: 3
-# This cop supports safe autocorrection (--autocorrect).
-Layout/HeredocIndentation:
- Exclude:
- - 'spec/controllers/well_known/host_meta_controller_spec.rb'
- - 'spec/lib/link_details_extractor_spec.rb'
-
-# Offense count: 5
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: normal, indented_internal_methods
-Layout/IndentationConsistency:
- Exclude:
- - 'spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb'
- - 'spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb'
- - 'spec/models/trends/statuses_spec.rb'
- - 'spec/services/import_service_spec.rb'
-
-# Offense count: 4
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: Width, AllowedPatterns.
-Layout/IndentationWidth:
- Exclude:
- - 'db/migrate/20161006213403_rails_settings_migration.rb'
- - 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb'
- - 'spec/services/account_statuses_cleanup_service_spec.rb'
- - 'spec/services/import_service_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
-Layout/LeadingCommentSpace:
- Exclude:
- - 'lib/paperclip/attachment_extensions.rb'
-
-# Offense count: 2
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AutoCorrect, EnforcedStyle.
-# SupportedStyles: space, no_space
-Layout/LineContinuationSpacing:
- Exclude:
- - 'spec/support/stories/profile_stories.rb'
-
# Offense count: 577
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
@@ -326,124 +169,6 @@ Layout/LineContinuationSpacing:
Layout/LineLength:
Enabled: false
-# Offense count: 4
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: symmetrical, new_line, same_line
-Layout/MultilineMethodCallBraceLayout:
- Exclude:
- - 'spec/models/account_statuses_cleanup_policy_spec.rb'
- - 'spec/services/activitypub/process_status_update_service_spec.rb'
-
-# Offense count: 3
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
-# SupportedStylesForExponentOperator: space, no_space
-Layout/SpaceAroundOperators:
- Exclude:
- - 'spec/services/activitypub/fetch_remote_status_service_spec.rb'
- - 'spec/validators/note_length_validator_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
-# SupportedStyles: space, no_space
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceBeforeBlockBraces:
- Exclude:
- - 'spec/controllers/api/v1/reports_controller_spec.rb'
-
-# Offense count: 3
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AllowForAlignment.
-Layout/SpaceBeforeFirstArg:
- Exclude:
- - 'spec/fabricators/custom_filter_keyword_fabricator.rb'
- - 'spec/fabricators/poll_vote_fabricator.rb'
- - 'spec/models/concerns/account_interactions_spec.rb'
-
-# Offense count: 24
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
-# SupportedStyles: space, no_space, compact
-# SupportedStylesForEmptyBrackets: space, no_space
-Layout/SpaceInsideArrayLiteralBrackets:
- Exclude:
- - 'db/migrate/20161006213403_rails_settings_migration.rb'
- - 'spec/controllers/settings/applications_controller_spec.rb'
- - 'spec/lib/extractor_spec.rb'
- - 'spec/models/export_spec.rb'
- - 'spec/services/activitypub/process_account_service_spec.rb'
- - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb'
-
-# Offense count: 4
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
-# SupportedStyles: space, no_space
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceInsideBlockBraces:
- Exclude:
- - 'spec/lib/fast_ip_map_spec.rb'
- - 'spec/models/user_role_spec.rb'
- - 'spec/serializers/rest/account_serializer_spec.rb'
- - 'spec/workers/activitypub/distribution_worker_spec.rb'
-
-# Offense count: 6
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
-# SupportedStyles: space, no_space, compact
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceInsideHashLiteralBraces:
- Exclude:
- - 'app/lib/activitypub/activity/create.rb'
- - 'app/services/activitypub/fetch_replies_service.rb'
- - 'spec/services/activitypub/process_collection_service_spec.rb'
- - 'spec/services/update_status_service_spec.rb'
-
-# Offense count: 1
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: space, compact, no_space
-Layout/SpaceInsideParens:
- Exclude:
- - 'spec/validators/unreserved_username_validator_spec.rb'
-
-# Offense count: 4
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: space, no_space
-Layout/SpaceInsideStringInterpolation:
- Exclude:
- - 'spec/controllers/auth/sessions_controller_spec.rb'
- - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb'
- - 'spec/services/activitypub/process_account_service_spec.rb'
-
-# Offense count: 8
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: final_newline, final_blank_line
-Layout/TrailingEmptyLines:
- Exclude:
- - 'db/migrate/20190306145741_add_lock_version_to_polls.rb'
- - 'db/migrate/20190807135426_add_comments_to_domain_blocks.rb'
- - 'db/migrate/20200312162302_add_status_ids_to_announcements.rb'
- - 'db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb'
- - 'db/migrate/20200628133322_create_account_notes.rb'
- - 'db/migrate/20210722120340_create_account_statuses_cleanup_policies.rb'
- - 'spec/fabricators/ip_block_fabricator.rb'
- - 'spec/fabricators/status_edit_fabricator.rb'
-
-# Offense count: 7
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AllowInHeredoc.
-Layout/TrailingWhitespace:
- Exclude:
- - 'app/models/concerns/expireable.rb'
- - 'db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb'
- - 'lib/tasks/mastodon.rake'
- - 'spec/models/account/field_spec.rb'
- - 'spec/services/remove_from_follwers_service_spec.rb'
-
# Offense count: 14
# Configuration parameters: AllowedMethods, AllowedPatterns.
Lint/AmbiguousBlockAssociation:
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 487b65223..f82112c02 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -327,7 +327,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
def resolve_thread(status)
return unless status.reply? && status.thread.nil? && Request.valid_url?(in_reply_to_uri)
- ThreadResolveWorker.perform_async(status.id, in_reply_to_uri, { 'request_id' => @options[:request_id]})
+ ThreadResolveWorker.perform_async(status.id, in_reply_to_uri, { 'request_id' => @options[:request_id] })
end
def fetch_replies(status)
@@ -338,7 +338,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
return unless replies.nil?
uri = value_or_id(collection)
- ActivityPub::FetchRepliesWorker.perform_async(status.id, uri, { 'request_id' => @options[:request_id]}) unless uri.nil?
+ ActivityPub::FetchRepliesWorker.perform_async(status.id, uri, { 'request_id' => @options[:request_id] }) unless uri.nil?
end
def conversation_from_uri(uri)
diff --git a/app/models/concerns/expireable.rb b/app/models/concerns/expireable.rb
index 4d902abcb..c64fc7d80 100644
--- a/app/models/concerns/expireable.rb
+++ b/app/models/concerns/expireable.rb
@@ -17,7 +17,7 @@ module Expireable
end
def expires_in=(interval)
- self.expires_at = interval.present? ? interval.to_i.seconds.from_now : nil
+ self.expires_at = interval.present? ? interval.to_i.seconds.from_now : nil
@expires_in = interval
end
diff --git a/app/services/activitypub/fetch_replies_service.rb b/app/services/activitypub/fetch_replies_service.rb
index 18a27e851..4128df9ca 100644
--- a/app/services/activitypub/fetch_replies_service.rb
+++ b/app/services/activitypub/fetch_replies_service.rb
@@ -10,7 +10,7 @@ class ActivityPub::FetchRepliesService < BaseService
@items = collection_items(collection_or_uri)
return if @items.nil?
- FetchReplyWorker.push_bulk(filtered_replies) { |reply_uri| [reply_uri, { 'request_id' => request_id}] }
+ FetchReplyWorker.push_bulk(filtered_replies) { |reply_uri| [reply_uri, { 'request_id' => request_id }] }
@items
end
diff --git a/db/migrate/20161006213403_rails_settings_migration.rb b/db/migrate/20161006213403_rails_settings_migration.rb
index 9d565cb5c..02932610c 100644
--- a/db/migrate/20161006213403_rails_settings_migration.rb
+++ b/db/migrate/20161006213403_rails_settings_migration.rb
@@ -1,8 +1,8 @@
MIGRATION_BASE_CLASS = if ActiveRecord::VERSION::MAJOR >= 5
- ActiveRecord::Migration[5.0]
-else
- ActiveRecord::Migration[4.2]
-end
+ ActiveRecord::Migration[5.0]
+ else
+ ActiveRecord::Migration[4.2]
+ end
class RailsSettingsMigration < MIGRATION_BASE_CLASS
def self.up
@@ -12,7 +12,7 @@ class RailsSettingsMigration < MIGRATION_BASE_CLASS
t.references :target, null: false, polymorphic: true, index: { name: 'index_settings_on_target_type_and_target_id' }
t.timestamps null: true
end
- add_index :settings, [ :target_type, :target_id, :var ], unique: true
+ add_index :settings, [:target_type, :target_id, :var], unique: true
end
def self.down
diff --git a/db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb b/db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb
index b29e62803..a3f883fcb 100644
--- a/db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb
+++ b/db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb
@@ -4,9 +4,9 @@ class ImproveIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Mi
disable_ddl_transaction!
def change
- # These changes ware reverted by migration 20180514140000.
- # add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently
- # add_index :statuses, [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently
- # remove_index :statuses, column: [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
+ # These changes ware reverted by migration 20180514140000.
+ # add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently
+ # add_index :statuses, [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently
+ # remove_index :statuses, column: [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
end
end
diff --git a/db/migrate/20190306145741_add_lock_version_to_polls.rb b/db/migrate/20190306145741_add_lock_version_to_polls.rb
index 5bb8cd3b4..c9fa471ad 100644
--- a/db/migrate/20190306145741_add_lock_version_to_polls.rb
+++ b/db/migrate/20190306145741_add_lock_version_to_polls.rb
@@ -21,4 +21,3 @@ class AddLockVersionToPolls < ActiveRecord::Migration[5.2]
remove_column :polls, :lock_version
end
end
-
diff --git a/db/migrate/20190807135426_add_comments_to_domain_blocks.rb b/db/migrate/20190807135426_add_comments_to_domain_blocks.rb
index b660a71ad..79b9f0212 100644
--- a/db/migrate/20190807135426_add_comments_to_domain_blocks.rb
+++ b/db/migrate/20190807135426_add_comments_to_domain_blocks.rb
@@ -4,4 +4,3 @@ class AddCommentsToDomainBlocks < ActiveRecord::Migration[5.2]
add_column :domain_blocks, :public_comment, :text
end
end
-
diff --git a/db/migrate/20200312162302_add_status_ids_to_announcements.rb b/db/migrate/20200312162302_add_status_ids_to_announcements.rb
index 42aa6513d..704d3773e 100644
--- a/db/migrate/20200312162302_add_status_ids_to_announcements.rb
+++ b/db/migrate/20200312162302_add_status_ids_to_announcements.rb
@@ -3,4 +3,3 @@ class AddStatusIdsToAnnouncements < ActiveRecord::Migration[5.2]
add_column :announcements, :status_ids, :bigint, array: true
end
end
-
diff --git a/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb b/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb
index 1d6ba1fe9..59bb1b9e2 100644
--- a/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb
+++ b/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb
@@ -19,4 +19,3 @@ class RemoveDuplicatedIndexesPghero < ActiveRecord::Migration[5.2]
add_index :markers, :user_id, name: :index_markers_on_user_id unless index_exists?(:markers, :user_id, name: :index_markers_on_user_id)
end
end
-
diff --git a/db/migrate/20200628133322_create_account_notes.rb b/db/migrate/20200628133322_create_account_notes.rb
index 664727e60..022e0ff3a 100644
--- a/db/migrate/20200628133322_create_account_notes.rb
+++ b/db/migrate/20200628133322_create_account_notes.rb
@@ -10,4 +10,3 @@ class CreateAccountNotes < ActiveRecord::Migration[5.2]
end
end
end
-
diff --git a/db/migrate/20210722120340_create_account_statuses_cleanup_policies.rb b/db/migrate/20210722120340_create_account_statuses_cleanup_policies.rb
index 28cfb6ef5..db168676a 100644
--- a/db/migrate/20210722120340_create_account_statuses_cleanup_policies.rb
+++ b/db/migrate/20210722120340_create_account_statuses_cleanup_policies.rb
@@ -17,4 +17,3 @@ class CreateAccountStatusesCleanupPolicies < ActiveRecord::Migration[6.1]
end
end
end
-
diff --git a/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb b/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb
index 7ed34a3ef..eb437c86c 100644
--- a/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb
+++ b/db/post_migrate/20220729171123_fix_custom_filter_keywords_id_seq.rb
@@ -5,7 +5,7 @@ class FixCustomFilterKeywordsIdSeq < ActiveRecord::Migration[6.1]
def up
# 20220613110711 manually inserts items with set `id` in the database, but
- # we also need to bump the sequence number, otherwise
+ # we also need to bump the sequence number, otherwise
safety_assured do
execute <<-SQL.squish
BEGIN;
diff --git a/lib/paperclip/attachment_extensions.rb b/lib/paperclip/attachment_extensions.rb
index d66a17623..7f82138aa 100644
--- a/lib/paperclip/attachment_extensions.rb
+++ b/lib/paperclip/attachment_extensions.rb
@@ -8,7 +8,7 @@ module Paperclip
# monkey-patch to avoid unlinking too avoid unlinking source file too early
# see https://github.com/kreeti/kt-paperclip/issues/64
- def post_process_style(name, style) #:nodoc:
+ def post_process_style(name, style) # :nodoc:
raise "Style #{name} has no processors defined." if style.processors.blank?
intermediate_files = []
@@ -16,16 +16,16 @@ module Paperclip
# if we're processing the original, close + unlink the source tempfile
intermediate_files << original if name == :original
- @queued_for_write[name] = style.processors.
- inject(original) do |file, processor|
+ @queued_for_write[name] = style.processors
+ .inject(original) do |file, processor|
file = Paperclip.processor(processor).make(file, style.processor_options, self)
intermediate_files << file unless file == original
file
end
unadapted_file = @queued_for_write[name]
- @queued_for_write[name] = Paperclip.io_adapters.
- for(@queued_for_write[name], @options[:adapter_options])
+ @queued_for_write[name] = Paperclip.io_adapters
+ .for(@queued_for_write[name], @options[:adapter_options])
unadapted_file.close if unadapted_file.respond_to?(:close)
@queued_for_write[name]
rescue Paperclip::Errors::NotIdentifiedByImageMagickError => e
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 1184e5273..477daa01b 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -286,13 +286,13 @@ namespace :mastodon do
q.required true
q.modify :strip
end
-
+
linksharing_access_key = prompt.ask('Storj Linksharing access key (uplink share --register --public --readonly=true --disallow-lists --not-after=none sj://bucket):') do |q|
q.required true
q.modify :strip
end
env['S3_ALIAS_HOST'] = "link.storjshare.io/raw/#{linksharing_access_key}/#{env['S3_BUCKET']}"
-
+
when 'Google Cloud Storage'
env['S3_ENABLED'] = 'true'
env['S3_PROTOCOL'] = 'https'
diff --git a/spec/config/initializers/rack_attack_spec.rb b/spec/config/initializers/rack_attack_spec.rb
index 581021cb9..03695f5fd 100644
--- a/spec/config/initializers/rack_attack_spec.rb
+++ b/spec/config/initializers/rack_attack_spec.rb
@@ -35,12 +35,12 @@ describe Rack::Attack do
let(:request) { ->() { post path, {}, 'REMOTE_ADDR' => remote_ip } }
context 'for exact path' do
- let(:path) { '/auth' }
+ let(:path) { '/auth' }
it_behaves_like 'throttled endpoint'
end
context 'for path with format' do
- let(:path) { '/auth.html' }
+ let(:path) { '/auth.html' }
it_behaves_like 'throttled endpoint'
end
end
@@ -50,7 +50,7 @@ describe Rack::Attack do
let(:request) { ->() { post path, {}, 'REMOTE_ADDR' => remote_ip } }
context 'for exact path' do
- let(:path) { '/api/v1/accounts' }
+ let(:path) { '/api/v1/accounts' }
it_behaves_like 'throttled endpoint'
end
@@ -70,12 +70,12 @@ describe Rack::Attack do
let(:request) { ->() { post path, {}, 'REMOTE_ADDR' => remote_ip } }
context 'for exact path' do
- let(:path) { '/auth/sign_in' }
+ let(:path) { '/auth/sign_in' }
it_behaves_like 'throttled endpoint'
end
context 'for path with format' do
- let(:path) { '/auth/sign_in.html' }
+ let(:path) { '/auth/sign_in.html' }
it_behaves_like 'throttled endpoint'
end
end
diff --git a/spec/controllers/admin/dashboard_controller_spec.rb b/spec/controllers/admin/dashboard_controller_spec.rb
index 6231a09a2..ab3738fcd 100644
--- a/spec/controllers/admin/dashboard_controller_spec.rb
+++ b/spec/controllers/admin/dashboard_controller_spec.rb
@@ -8,10 +8,10 @@ describe Admin::DashboardController, type: :controller do
describe 'GET #index' do
before do
allow(Admin::SystemCheck).to receive(:perform).and_return([
- Admin::SystemCheck::Message.new(:database_schema_check),
- Admin::SystemCheck::Message.new(:rules_check, nil, admin_rules_path),
- Admin::SystemCheck::Message.new(:sidekiq_process_check, 'foo, bar'),
- ])
+ Admin::SystemCheck::Message.new(:database_schema_check),
+ Admin::SystemCheck::Message.new(:rules_check, nil, admin_rules_path),
+ Admin::SystemCheck::Message.new(:sidekiq_process_check, 'foo, bar'),
+ ])
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin'))
end
diff --git a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb
index b2557d957..89cc8acad 100644
--- a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb
@@ -70,7 +70,7 @@ describe Api::V1::Accounts::CredentialsController do
it 'returns http success' do
expect(response).to have_http_status(200)
end
- end
+ end
describe 'with invalid data' do
before do
diff --git a/spec/controllers/api/v1/reports_controller_spec.rb b/spec/controllers/api/v1/reports_controller_spec.rb
index dbc64e704..78a72b95b 100644
--- a/spec/controllers/api/v1/reports_controller_spec.rb
+++ b/spec/controllers/api/v1/reports_controller_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe Api::V1::ReportsController, type: :controller do
let(:target_account) { status.account }
let(:category) { nil }
let(:forward) { nil }
- let(:rule_ids){ nil }
+ let(:rule_ids) { nil }
before do
allow(AdminMailer).to receive(:new_report).and_return(double('email', deliver_later: nil))
diff --git a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb
index 7cc77f430..4dcaba6bd 100644
--- a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb
+++ b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
it 'returns accounts who favorited the status' do
get :index, params: { status_id: status.id, limit: 2 }
expect(body_as_json.size).to eq 2
- expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
+ expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
end
it 'does not return blocked users' do
diff --git a/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb b/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb
index 8d4a6f91c..dc36d4ca0 100644
--- a/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb
+++ b/spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controll
it 'returns accounts who reblogged the status' do
get :index, params: { status_id: status.id, limit: 2 }
expect(body_as_json.size).to eq 2
- expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
+ expect([body_as_json[0][:id], body_as_json[1][:id]]).to match_array([alice.id.to_s, bob.id.to_s])
end
it 'does not return blocked users' do
diff --git a/spec/controllers/api/v2/filters/statuses_controller_spec.rb b/spec/controllers/api/v2/filters/statuses_controller_spec.rb
index 9740c1eb3..969b2ea73 100644
--- a/spec/controllers/api/v2/filters/statuses_controller_spec.rb
+++ b/spec/controllers/api/v2/filters/statuses_controller_spec.rb
@@ -64,7 +64,7 @@ RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
end
describe 'GET #show' do
- let(:scopes) { 'read:filters' }
+ let(:scopes) { 'read:filters' }
let!(:status_filter) { Fabricate(:custom_filter_status, custom_filter: filter) }
before do
@@ -90,7 +90,7 @@ RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
end
describe 'DELETE #destroy' do
- let(:scopes) { 'write:filters' }
+ let(:scopes) { 'write:filters' }
let(:status_filter) { Fabricate(:custom_filter_status, custom_filter: filter) }
before do
diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb
index d3db7aa1a..64433ddf4 100644
--- a/spec/controllers/auth/sessions_controller_spec.rb
+++ b/spec/controllers/auth/sessions_controller_spec.rb
@@ -339,11 +339,11 @@ RSpec.describe Auth::SessionsController, type: :controller do
external_id: public_key_credential.id,
public_key: public_key_credential.public_key,
sign_count: '1000'
- )
+ )
user.webauthn_credentials.take
end
- let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http' }://#{Rails.configuration.x.web_domain}" }
+ let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http'}://#{Rails.configuration.x.web_domain}" }
let(:fake_client) { WebAuthn::FakeClient.new(domain) }
@@ -400,7 +400,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
describe 'GET #webauthn_options' do
context 'with WebAuthn and OTP enabled as second factor' do
- let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http' }://#{Rails.configuration.x.web_domain}" }
+ let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http'}://#{Rails.configuration.x.web_domain}" }
let(:fake_client) { WebAuthn::FakeClient.new(domain) }
diff --git a/spec/controllers/authorize_interactions_controller_spec.rb b/spec/controllers/authorize_interactions_controller_spec.rb
index 44f52df69..e52103941 100644
--- a/spec/controllers/authorize_interactions_controller_spec.rb
+++ b/spec/controllers/authorize_interactions_controller_spec.rb
@@ -99,7 +99,6 @@ describe AuthorizeInteractionsController do
allow(ResolveAccountService).to receive(:new).and_return(service)
allow(service).to receive(:call).with('user@hostname').and_return(target_account)
-
post :create, params: { acct: 'acct:user@hostname' }
expect(account.following?(target_account)).to be true
diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb
index 1292e9ff8..9074574e4 100644
--- a/spec/controllers/settings/applications_controller_spec.rb
+++ b/spec/controllers/settings/applications_controller_spec.rb
@@ -73,7 +73,7 @@ describe Settings::ApplicationsController do
name: 'My New App',
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
website: 'http://google.com',
- scopes: [ 'read', 'write', 'follow' ]
+ scopes: ['read', 'write', 'follow']
}
}
response
diff --git a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
index 569c8322b..0b807b280 100644
--- a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
+++ b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
@@ -5,7 +5,6 @@ require 'rails_helper'
describe Settings::TwoFactorAuthentication::ConfirmationsController do
render_views
-
shared_examples 'renders :new' do
it 'renders the new view' do
subject
diff --git a/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb
index fe53b4dfc..06989ffd2 100644
--- a/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb
+++ b/spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb
@@ -7,7 +7,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
render_views
let(:user) { Fabricate(:user) }
- let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http' }://#{Rails.configuration.x.web_domain}" }
+ let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http'}://#{Rails.configuration.x.web_domain}" }
let(:fake_client) { WebAuthn::FakeClient.new(domain) }
def add_webauthn_credential(user)
diff --git a/spec/controllers/well_known/host_meta_controller_spec.rb b/spec/controllers/well_known/host_meta_controller_spec.rb
index c02aa0d59..654bad406 100644
--- a/spec/controllers/well_known/host_meta_controller_spec.rb
+++ b/spec/controllers/well_known/host_meta_controller_spec.rb
@@ -9,12 +9,12 @@ describe WellKnown::HostMetaController, type: :controller do
expect(response).to have_http_status(200)
expect(response.media_type).to eq 'application/xrd+xml'
- expect(response.body).to eq <
-
-
-
-XML
+ expect(response.body).to eq <<~XML
+
+
+
+
+ XML
end
end
end
diff --git a/spec/fabricators/custom_filter_keyword_fabricator.rb b/spec/fabricators/custom_filter_keyword_fabricator.rb
index 0f101dcd1..201566cbe 100644
--- a/spec/fabricators/custom_filter_keyword_fabricator.rb
+++ b/spec/fabricators/custom_filter_keyword_fabricator.rb
@@ -1,4 +1,4 @@
Fabricator(:custom_filter_keyword) do
custom_filter
- keyword 'discourse'
+ keyword 'discourse'
end
diff --git a/spec/fabricators/ip_block_fabricator.rb b/spec/fabricators/ip_block_fabricator.rb
index 31dc336e6..1797f6877 100644
--- a/spec/fabricators/ip_block_fabricator.rb
+++ b/spec/fabricators/ip_block_fabricator.rb
@@ -3,4 +3,4 @@ Fabricator(:ip_block) do
severity ""
expires_at "2020-10-08 22:20:37"
comment "MyText"
-end
\ No newline at end of file
+end
diff --git a/spec/fabricators/poll_vote_fabricator.rb b/spec/fabricators/poll_vote_fabricator.rb
index 51f9b006e..c06e61f67 100644
--- a/spec/fabricators/poll_vote_fabricator.rb
+++ b/spec/fabricators/poll_vote_fabricator.rb
@@ -1,5 +1,5 @@
Fabricator(:poll_vote) do
account
poll
- choice 0
+ choice 0
end
diff --git a/spec/fabricators/status_edit_fabricator.rb b/spec/fabricators/status_edit_fabricator.rb
index 21b793747..3141759e5 100644
--- a/spec/fabricators/status_edit_fabricator.rb
+++ b/spec/fabricators/status_edit_fabricator.rb
@@ -4,4 +4,4 @@ Fabricator(:status_edit) do
text "MyText"
spoiler_text "MyText"
media_attachments_changed false
-end
\ No newline at end of file
+end
diff --git a/spec/fabricators/system_key_fabricator.rb b/spec/fabricators/system_key_fabricator.rb
index f808495e0..c744bb286 100644
--- a/spec/fabricators/system_key_fabricator.rb
+++ b/spec/fabricators/system_key_fabricator.rb
@@ -1,3 +1,2 @@
Fabricator(:system_key) do
-
end
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb
index 1a25395fa..cd0f2df6e 100644
--- a/spec/lib/activitypub/activity/create_spec.rb
+++ b/spec/lib/activitypub/activity/create_spec.rb
@@ -408,7 +408,6 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
-
context 'with media attachments with long description' do
let(:object_json) do
{
diff --git a/spec/lib/extractor_spec.rb b/spec/lib/extractor_spec.rb
index dba4bd0bb..9c9f5ef04 100644
--- a/spec/lib/extractor_spec.rb
+++ b/spec/lib/extractor_spec.rb
@@ -20,7 +20,7 @@ describe Extractor do
text = '@screen_name'
extracted = Extractor.extract_mentions_or_lists_with_indices(text)
expect(extracted).to eq [
- { screen_name: 'screen_name', indices: [ 0, 12 ] }
+ { screen_name: 'screen_name', indices: [0, 12] }
]
end
@@ -44,19 +44,19 @@ describe Extractor do
it 'does not exclude normal hash text before ://' do
text = '#hashtag://'
extracted = Extractor.extract_hashtags_with_indices(text)
- expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ]
+ expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }]
end
it 'excludes http://' do
text = '#hashtaghttp://'
extracted = Extractor.extract_hashtags_with_indices(text)
- expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ]
+ expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }]
end
it 'excludes https://' do
text = '#hashtaghttps://'
extracted = Extractor.extract_hashtags_with_indices(text)
- expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ]
+ expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }]
end
it 'yields hashtags if a block is given' do
diff --git a/spec/lib/fast_ip_map_spec.rb b/spec/lib/fast_ip_map_spec.rb
index c66f64828..78b3ddb05 100644
--- a/spec/lib/fast_ip_map_spec.rb
+++ b/spec/lib/fast_ip_map_spec.rb
@@ -4,7 +4,7 @@ require 'rails_helper'
describe FastIpMap do
describe '#include?' do
- subject { described_class.new([IPAddr.new('20.4.0.0/16'), IPAddr.new('145.22.30.0/24'), IPAddr.new('189.45.86.3')])}
+ subject { described_class.new([IPAddr.new('20.4.0.0/16'), IPAddr.new('145.22.30.0/24'), IPAddr.new('189.45.86.3')]) }
it 'returns true for an exact match' do
expect(subject.include?(IPAddr.new('189.45.86.3'))).to be true
diff --git a/spec/lib/link_details_extractor_spec.rb b/spec/lib/link_details_extractor_spec.rb
index 7ea867c61..7eb15ced3 100644
--- a/spec/lib/link_details_extractor_spec.rb
+++ b/spec/lib/link_details_extractor_spec.rb
@@ -39,17 +39,17 @@ RSpec.describe LinkDetailsExtractor do
let(:original_url) { 'https://example.com/page.html' }
context 'and is wrapped in CDATA tags' do
- let(:html) { <<-HTML }
-
-
-
-
-
-
+ let(:html) { <<~HTML }
+
+
+
+
+
+
HTML
describe '#title' do
@@ -78,57 +78,57 @@ RSpec.describe LinkDetailsExtractor do
end
context 'but the first tag is invalid JSON' do
- let(:html) { <<-HTML }
-
-
-
-
-
-
-
+ let(:html) { <<~HTML }
+
+
+
+
+
+
+
HTML
describe '#title' do
diff --git a/spec/models/account/field_spec.rb b/spec/models/account/field_spec.rb
index 0ac9769bc..40bbee025 100644
--- a/spec/models/account/field_spec.rb
+++ b/spec/models/account/field_spec.rb
@@ -97,7 +97,7 @@ RSpec.describe Account::Field, type: :model do
expect(subject.verifiable?).to be false
end
end
-
+
context 'for text which is blank' do
let(:value) { '' }
@@ -149,7 +149,7 @@ RSpec.describe Account::Field, type: :model do
expect(subject.verifiable?).to be false
end
end
-
+
context 'for text which is blank' do
let(:value) { '' }
diff --git a/spec/models/account_alias_spec.rb b/spec/models/account_alias_spec.rb
index 27ec215aa..c48b804b2 100644
--- a/spec/models/account_alias_spec.rb
+++ b/spec/models/account_alias_spec.rb
@@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe AccountAlias, type: :model do
-
end
diff --git a/spec/models/account_statuses_cleanup_policy_spec.rb b/spec/models/account_statuses_cleanup_policy_spec.rb
index 684a1aa41..f11684516 100644
--- a/spec/models/account_statuses_cleanup_policy_spec.rb
+++ b/spec/models/account_statuses_cleanup_policy_spec.rb
@@ -16,16 +16,15 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
context 'when widening a policy' do
let!(:account_statuses_cleanup_policy) do
Fabricate(:account_statuses_cleanup_policy,
- account: account,
- keep_direct: true,
- keep_pinned: true,
- keep_polls: true,
- keep_media: true,
- keep_self_fav: true,
- keep_self_bookmark: true,
- min_favs: 1,
- min_reblogs: 1
- )
+ account: account,
+ keep_direct: true,
+ keep_pinned: true,
+ keep_polls: true,
+ keep_media: true,
+ keep_self_fav: true,
+ keep_self_bookmark: true,
+ min_favs: 1,
+ min_reblogs: 1)
end
before do
@@ -96,16 +95,15 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
context 'when narrowing a policy' do
let!(:account_statuses_cleanup_policy) do
Fabricate(:account_statuses_cleanup_policy,
- account: account,
- keep_direct: false,
- keep_pinned: false,
- keep_polls: false,
- keep_media: false,
- keep_self_fav: false,
- keep_self_bookmark: false,
- min_favs: nil,
- min_reblogs: nil
- )
+ account: account,
+ keep_direct: false,
+ keep_pinned: false,
+ keep_polls: false,
+ keep_media: false,
+ keep_self_fav: false,
+ keep_self_bookmark: false,
+ min_favs: nil,
+ min_reblogs: nil)
end
it 'does not unnecessarily invalidate last_inspected' do
@@ -232,7 +230,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
end
describe '#compute_cutoff_id' do
- let!(:unrelated_status) { Fabricate(:status, created_at: 3.years.ago) }
+ let!(:unrelated_status) { Fabricate(:status, created_at: 3.years.ago) }
let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }
subject { account_statuses_cleanup_policy.compute_cutoff_id }
diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb
index 5cb4a83f7..e628384d0 100644
--- a/spec/models/concerns/account_interactions_spec.rb
+++ b/spec/models/concerns/account_interactions_spec.rb
@@ -400,7 +400,7 @@ describe AccountInteractions do
subject { account.domain_blocking?(domain) }
context 'blocking the domain' do
- it' returns true' 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
diff --git a/spec/models/device_spec.rb b/spec/models/device_spec.rb
index f56fbf978..307552e91 100644
--- a/spec/models/device_spec.rb
+++ b/spec/models/device_spec.rb
@@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe Device, type: :model do
-
end
diff --git a/spec/models/encrypted_message_spec.rb b/spec/models/encrypted_message_spec.rb
index 1238d57b6..64f9c6912 100644
--- a/spec/models/encrypted_message_spec.rb
+++ b/spec/models/encrypted_message_spec.rb
@@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe EncryptedMessage, type: :model do
-
end
diff --git a/spec/models/export_spec.rb b/spec/models/export_spec.rb
index 135d7a36b..5202ae9e1 100644
--- a/spec/models/export_spec.rb
+++ b/spec/models/export_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe Export do
let(:account) { Fabricate(:account) }
let(:target_accounts) do
- [ {}, { username: 'one', domain: 'local.host' } ].map(&method(:Fabricate).curry(2).call(:account))
+ [{}, { username: 'one', domain: 'local.host' }].map(&method(:Fabricate).curry(2).call(:account))
end
describe 'to_csv' do
diff --git a/spec/models/login_activity_spec.rb b/spec/models/login_activity_spec.rb
index ba2d207c9..12d8c4363 100644
--- a/spec/models/login_activity_spec.rb
+++ b/spec/models/login_activity_spec.rb
@@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe LoginActivity, type: :model do
-
end
diff --git a/spec/models/one_time_key_spec.rb b/spec/models/one_time_key_spec.rb
index 34598334c..4b231c600 100644
--- a/spec/models/one_time_key_spec.rb
+++ b/spec/models/one_time_key_spec.rb
@@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe OneTimeKey, type: :model do
-
end
diff --git a/spec/models/system_key_spec.rb b/spec/models/system_key_spec.rb
index a138bc131..86f07f964 100644
--- a/spec/models/system_key_spec.rb
+++ b/spec/models/system_key_spec.rb
@@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe SystemKey, type: :model do
-
end
diff --git a/spec/models/trends/statuses_spec.rb b/spec/models/trends/statuses_spec.rb
index 5f338a65e..98a8c7264 100644
--- a/spec/models/trends/statuses_spec.rb
+++ b/spec/models/trends/statuses_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe Trends::Statuses do
before do
13.times { reblog(status1, today) }
13.times { reblog(status2, today) }
- 4.times { reblog(status3, today) }
+ 4.times { reblog(status3, today) }
end
context do
diff --git a/spec/models/user_role_spec.rb b/spec/models/user_role_spec.rb
index 28019593e..abf7d0e27 100644
--- a/spec/models/user_role_spec.rb
+++ b/spec/models/user_role_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe UserRole, type: :model do
end
describe '#permissions_as_keys=' do
- let(:input) { }
+ let(:input) {}
before do
subject.permissions_as_keys = input
diff --git a/spec/routing/api_routing_spec.rb b/spec/routing/api_routing_spec.rb
index 2683ccb8d..a822fba4c 100644
--- a/spec/routing/api_routing_spec.rb
+++ b/spec/routing/api_routing_spec.rb
@@ -5,99 +5,99 @@ require 'rails_helper'
describe 'API routes' do
describe 'Credentials routes' do
it 'routes to verify credentials' do
- expect(get('/api/v1/accounts/verify_credentials')).
- to route_to('api/v1/accounts/credentials#show')
+ expect(get('/api/v1/accounts/verify_credentials'))
+ .to route_to('api/v1/accounts/credentials#show')
end
it 'routes to update credentials' do
- expect(patch('/api/v1/accounts/update_credentials')).
- to route_to('api/v1/accounts/credentials#update')
+ expect(patch('/api/v1/accounts/update_credentials'))
+ .to route_to('api/v1/accounts/credentials#update')
end
end
describe 'Account routes' do
it 'routes to statuses' do
- expect(get('/api/v1/accounts/user/statuses')).
- to route_to('api/v1/accounts/statuses#index', account_id: 'user')
+ expect(get('/api/v1/accounts/user/statuses'))
+ .to route_to('api/v1/accounts/statuses#index', account_id: 'user')
end
it 'routes to followers' do
- expect(get('/api/v1/accounts/user/followers')).
- to route_to('api/v1/accounts/follower_accounts#index', account_id: 'user')
+ expect(get('/api/v1/accounts/user/followers'))
+ .to route_to('api/v1/accounts/follower_accounts#index', account_id: 'user')
end
it 'routes to following' do
- expect(get('/api/v1/accounts/user/following')).
- to route_to('api/v1/accounts/following_accounts#index', account_id: 'user')
+ expect(get('/api/v1/accounts/user/following'))
+ .to route_to('api/v1/accounts/following_accounts#index', account_id: 'user')
end
it 'routes to search' do
- expect(get('/api/v1/accounts/search')).
- to route_to('api/v1/accounts/search#show')
+ expect(get('/api/v1/accounts/search'))
+ .to route_to('api/v1/accounts/search#show')
end
it 'routes to relationships' do
- expect(get('/api/v1/accounts/relationships')).
- to route_to('api/v1/accounts/relationships#index')
+ expect(get('/api/v1/accounts/relationships'))
+ .to route_to('api/v1/accounts/relationships#index')
end
end
describe 'Statuses routes' do
it 'routes reblogged_by' do
- expect(get('/api/v1/statuses/123/reblogged_by')).
- to route_to('api/v1/statuses/reblogged_by_accounts#index', status_id: '123')
+ expect(get('/api/v1/statuses/123/reblogged_by'))
+ .to route_to('api/v1/statuses/reblogged_by_accounts#index', status_id: '123')
end
it 'routes favourited_by' do
- expect(get('/api/v1/statuses/123/favourited_by')).
- to route_to('api/v1/statuses/favourited_by_accounts#index', status_id: '123')
+ expect(get('/api/v1/statuses/123/favourited_by'))
+ .to route_to('api/v1/statuses/favourited_by_accounts#index', status_id: '123')
end
it 'routes reblog' do
- expect(post('/api/v1/statuses/123/reblog')).
- to route_to('api/v1/statuses/reblogs#create', status_id: '123')
+ expect(post('/api/v1/statuses/123/reblog'))
+ .to route_to('api/v1/statuses/reblogs#create', status_id: '123')
end
it 'routes unreblog' do
- expect(post('/api/v1/statuses/123/unreblog')).
- to route_to('api/v1/statuses/reblogs#destroy', status_id: '123')
+ expect(post('/api/v1/statuses/123/unreblog'))
+ .to route_to('api/v1/statuses/reblogs#destroy', status_id: '123')
end
it 'routes favourite' do
- expect(post('/api/v1/statuses/123/favourite')).
- to route_to('api/v1/statuses/favourites#create', status_id: '123')
+ expect(post('/api/v1/statuses/123/favourite'))
+ .to route_to('api/v1/statuses/favourites#create', status_id: '123')
end
it 'routes unfavourite' do
- expect(post('/api/v1/statuses/123/unfavourite')).
- to route_to('api/v1/statuses/favourites#destroy', status_id: '123')
+ expect(post('/api/v1/statuses/123/unfavourite'))
+ .to route_to('api/v1/statuses/favourites#destroy', status_id: '123')
end
it 'routes mute' do
- expect(post('/api/v1/statuses/123/mute')).
- to route_to('api/v1/statuses/mutes#create', status_id: '123')
+ expect(post('/api/v1/statuses/123/mute'))
+ .to route_to('api/v1/statuses/mutes#create', status_id: '123')
end
it 'routes unmute' do
- expect(post('/api/v1/statuses/123/unmute')).
- to route_to('api/v1/statuses/mutes#destroy', status_id: '123')
+ expect(post('/api/v1/statuses/123/unmute'))
+ .to route_to('api/v1/statuses/mutes#destroy', status_id: '123')
end
end
describe 'Timeline routes' do
it 'routes to home timeline' do
- expect(get('/api/v1/timelines/home')).
- to route_to('api/v1/timelines/home#show')
+ expect(get('/api/v1/timelines/home'))
+ .to route_to('api/v1/timelines/home#show')
end
it 'routes to public timeline' do
- expect(get('/api/v1/timelines/public')).
- to route_to('api/v1/timelines/public#show')
+ expect(get('/api/v1/timelines/public'))
+ .to route_to('api/v1/timelines/public#show')
end
it 'routes to tag timeline' do
- expect(get('/api/v1/timelines/tag/test')).
- to route_to('api/v1/timelines/tag#show', id: 'test')
+ expect(get('/api/v1/timelines/tag/test'))
+ .to route_to('api/v1/timelines/tag#show', id: 'test')
end
end
end
diff --git a/spec/routing/well_known_routes_spec.rb b/spec/routing/well_known_routes_spec.rb
index 2e25605c2..03a562843 100644
--- a/spec/routing/well_known_routes_spec.rb
+++ b/spec/routing/well_known_routes_spec.rb
@@ -2,14 +2,14 @@ require 'rails_helper'
describe 'the host-meta route' do
it 'routes to correct place with xml format' do
- expect(get('/.well-known/host-meta')).
- to route_to('well_known/host_meta#show', format: 'xml')
+ expect(get('/.well-known/host-meta'))
+ .to route_to('well_known/host_meta#show', format: 'xml')
end
end
describe 'the webfinger route' do
it 'routes to correct place with json format' do
- expect(get('/.well-known/webfinger')).
- to route_to('well_known/webfinger#show')
+ expect(get('/.well-known/webfinger'))
+ .to route_to('well_known/webfinger#show')
end
end
diff --git a/spec/serializers/rest/account_serializer_spec.rb b/spec/serializers/rest/account_serializer_spec.rb
index 5b08d5aca..3bca06b73 100644
--- a/spec/serializers/rest/account_serializer_spec.rb
+++ b/spec/serializers/rest/account_serializer_spec.rb
@@ -5,7 +5,7 @@ require 'rails_helper'
describe REST::AccountSerializer do
let(:role) { Fabricate(:user_role, name: 'Role', highlighted: true) }
let(:user) { Fabricate(:user, role: role) }
- let(:account) { user.account}
+ let(:account) { user.account }
subject { JSON.parse(ActiveModelSerializers::SerializableResource.new(account, serializer: REST::AccountSerializer).to_json) }
diff --git a/spec/services/account_statuses_cleanup_service_spec.rb b/spec/services/account_statuses_cleanup_service_spec.rb
index 257655c41..a30e14ab6 100644
--- a/spec/services/account_statuses_cleanup_service_spec.rb
+++ b/spec/services/account_statuses_cleanup_service_spec.rb
@@ -42,8 +42,8 @@ describe AccountStatusesCleanupService, type: :service do
context 'when called repeatedly with a budget of 2' do
it 'reports 2 then 1 deleted statuses' do
- expect(subject.call(account_policy, 2)).to eq 2
- expect(subject.call(account_policy, 2)).to eq 1
+ expect(subject.call(account_policy, 2)).to eq 2
+ expect(subject.call(account_policy, 2)).to eq 1
end
it 'actually deletes the statuses in the expected order' do
diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb
index a81dcad81..d6145c9b8 100644
--- a/spec/services/activitypub/fetch_remote_status_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb
@@ -298,7 +298,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
first: {
type: 'CollectionPage',
partOf: "https://foo.bar/@foo/#{i}/replies",
- items: ["https://foo.bar/@foo/#{i+1}"],
+ items: ["https://foo.bar/@foo/#{i + 1}"],
},
},
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
diff --git a/spec/services/activitypub/process_account_service_spec.rb b/spec/services/activitypub/process_account_service_spec.rb
index 2b20d17b1..40caa6eb0 100644
--- a/spec/services/activitypub/process_account_service_spec.rb
+++ b/spec/services/activitypub/process_account_service_spec.rb
@@ -172,10 +172,10 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
{
type: 'Mention',
href: "https://foo.test/users/#{i + 1}",
- name: "@user#{i + 1 }",
+ name: "@user#{i + 1}",
}
],
- to: [ 'as:Public', "https://foo.test/users/#{i + 1}" ]
+ to: ['as:Public', "https://foo.test/users/#{i + 1}"]
}.with_indifferent_access
featured_json = {
'@context': ['https://www.w3.org/ns/activitystreams'],
diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb
index a308cede7..cb60e1cb8 100644
--- a/spec/services/activitypub/process_collection_service_spec.rb
+++ b/spec/services/activitypub/process_collection_service_spec.rb
@@ -95,11 +95,11 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
context 'when receiving a fabricated status' do
let!(:actor) do
Fabricate(:account,
- username: 'bob',
- domain: 'example.com',
- uri: 'https://example.com/users/bob',
- public_key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuuYyoyfsRkYnXRotMsId\nW3euBDDfiv9oVqOxUVC7bhel8KednIMrMCRWFAkgJhbrlzbIkjVr68o1MP9qLcn7\nCmH/BXHp7yhuFTr4byjdJKpwB+/i2jNEsvDH5jR8WTAeTCe0x/QHg21V3F7dSI5m\nCCZ/1dSIyOXLRTWVlfDlm3rE4ntlCo+US3/7oSWbg/4/4qEnt1HC32kvklgScxua\n4LR5ATdoXa5bFoopPWhul7MJ6NyWCyQyScUuGdlj8EN4kmKQJvphKHrI9fvhgOuG\nTvhTR1S5InA4azSSchY0tXEEw/VNxraeX0KPjbgr6DPcwhPd/m0nhVDq0zVyVBBD\nMwIDAQAB\n-----END PUBLIC KEY-----\n",
- private_key: nil)
+ username: 'bob',
+ domain: 'example.com',
+ uri: 'https://example.com/users/bob',
+ public_key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuuYyoyfsRkYnXRotMsId\nW3euBDDfiv9oVqOxUVC7bhel8KednIMrMCRWFAkgJhbrlzbIkjVr68o1MP9qLcn7\nCmH/BXHp7yhuFTr4byjdJKpwB+/i2jNEsvDH5jR8WTAeTCe0x/QHg21V3F7dSI5m\nCCZ/1dSIyOXLRTWVlfDlm3rE4ntlCo+US3/7oSWbg/4/4qEnt1HC32kvklgScxua\n4LR5ATdoXa5bFoopPWhul7MJ6NyWCyQyScUuGdlj8EN4kmKQJvphKHrI9fvhgOuG\nTvhTR1S5InA4azSSchY0tXEEw/VNxraeX0KPjbgr6DPcwhPd/m0nhVDq0zVyVBBD\nMwIDAQAB\n-----END PUBLIC KEY-----\n",
+ private_key: nil)
end
let(:payload) do
@@ -107,7 +107,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
'@context': [
'https://www.w3.org/ns/activitystreams',
nil,
- {'object': 'https://www.w3.org/ns/activitystreams#object'}
+ { 'object': 'https://www.w3.org/ns/activitystreams#object' }
],
'id': 'https://example.com/users/bob/fake-status/activity',
'type': 'Create',
diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb
index 750369d57..04292c507 100644
--- a/spec/services/activitypub/process_status_update_service_spec.rb
+++ b/spec/services/activitypub/process_status_update_service_spec.rb
@@ -104,20 +104,19 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
context 'when the status has not been explicitly edited and features a poll' do
- let(:account) { Fabricate(:account, domain: 'example.com') }
+ let(:account) { Fabricate(:account, domain: 'example.com') }
let!(:expiration) { 10.days.from_now.utc }
let!(:status) do
Fabricate(:status,
- text: 'Hello world',
- account: account,
- poll_attributes: {
- options: %w(Foo Bar),
- account: account,
- multiple: false,
- hide_totals: false,
- expires_at: expiration
- }
- )
+ text: 'Hello world',
+ account: account,
+ poll_attributes: {
+ options: %w(Foo Bar),
+ account: account,
+ multiple: false,
+ hide_totals: false,
+ expires_at: expiration
+ })
end
let(:payload) do
@@ -156,20 +155,19 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
context 'when the status changes a poll despite being not explicitly marked as updated' do
- let(:account) { Fabricate(:account, domain: 'example.com') }
+ let(:account) { Fabricate(:account, domain: 'example.com') }
let!(:expiration) { 10.days.from_now.utc }
let!(:status) do
Fabricate(:status,
- text: 'Hello world',
- account: account,
- poll_attributes: {
- options: %w(Foo Bar),
- account: account,
- multiple: false,
- hide_totals: false,
- expires_at: expiration
- }
- )
+ text: 'Hello world',
+ account: account,
+ poll_attributes: {
+ options: %w(Foo Bar),
+ account: account,
+ multiple: false,
+ hide_totals: false,
+ expires_at: expiration
+ })
end
let(:payload) do
diff --git a/spec/services/bootstrap_timeline_service_spec.rb b/spec/services/bootstrap_timeline_service_spec.rb
index 16f3e9962..149f6e6df 100644
--- a/spec/services/bootstrap_timeline_service_spec.rb
+++ b/spec/services/bootstrap_timeline_service_spec.rb
@@ -32,6 +32,5 @@ RSpec.describe BootstrapTimelineService, type: :service do
expect(service).to_not have_received(:call)
end
end
-
end
end
diff --git a/spec/services/fetch_oembed_service_spec.rb b/spec/services/fetch_oembed_service_spec.rb
index 88f0113ed..da2a8d0d1 100644
--- a/spec/services/fetch_oembed_service_spec.rb
+++ b/spec/services/fetch_oembed_service_spec.rb
@@ -151,7 +151,6 @@ describe FetchOEmbedService, type: :service do
expect(subject.format).to eq :json
end
end
-
end
context 'when endpoint is cached' do
diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb
index e2d182920..217d0ee24 100644
--- a/spec/services/import_service_spec.rb
+++ b/spec/services/import_service_spec.rb
@@ -178,7 +178,7 @@ RSpec.describe ImportService, type: :service do
context 'utf-8 encoded domains' do
subject { ImportService.new }
- let!(:nare) { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') }
+ let!(:nare) { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') }
# Make sure to not actually go to the remote server
before do
@@ -189,7 +189,7 @@ RSpec.describe ImportService, type: :service do
let(:import) { Import.create(account: account, type: 'following', data: csv) }
it 'follows the listed account' do
- expect(account.follow_requests.count).to eq 0
+ expect(account.follow_requests.count).to eq 0
subject.call(import)
expect(account.follow_requests.count).to eq 1
end
diff --git a/spec/services/remove_from_follwers_service_spec.rb b/spec/services/remove_from_follwers_service_spec.rb
index a83f6f49a..9b9c846cf 100644
--- a/spec/services/remove_from_follwers_service_spec.rb
+++ b/spec/services/remove_from_follwers_service_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe RemoveFromFollowersService, type: :service do
describe 'local' do
let(:sender) { Fabricate(:account, username: 'alice') }
-
+
before do
Follow.create(account: sender, target_account: bob)
subject.call(bob, sender)
diff --git a/spec/services/remove_status_service_spec.rb b/spec/services/remove_status_service_spec.rb
index 482068d58..e253052f3 100644
--- a/spec/services/remove_status_service_spec.rb
+++ b/spec/services/remove_status_service_spec.rb
@@ -37,29 +37,29 @@ RSpec.describe RemoveStatusService, type: :service do
it 'sends Delete activity to followers' do
subject.call(@status)
expect(a_request(:post, 'http://example.com/inbox').with(
- body: hash_including({
- 'type' => 'Delete',
- 'object' => {
- 'type' => 'Tombstone',
- 'id' => ActivityPub::TagManager.instance.uri_for(@status),
- 'atomUri' => OStatus::TagManager.instance.uri_for(@status),
- },
- })
- )).to have_been_made.once
+ body: hash_including({
+ 'type' => 'Delete',
+ 'object' => {
+ 'type' => 'Tombstone',
+ 'id' => ActivityPub::TagManager.instance.uri_for(@status),
+ 'atomUri' => OStatus::TagManager.instance.uri_for(@status),
+ },
+ })
+ )).to have_been_made.once
end
it 'sends Delete activity to rebloggers' do
subject.call(@status)
expect(a_request(:post, 'http://example2.com/inbox').with(
- body: hash_including({
- 'type' => 'Delete',
- 'object' => {
- 'type' => 'Tombstone',
- 'id' => ActivityPub::TagManager.instance.uri_for(@status),
- 'atomUri' => OStatus::TagManager.instance.uri_for(@status),
- },
- })
- )).to have_been_made.once
+ body: hash_including({
+ 'type' => 'Delete',
+ 'object' => {
+ 'type' => 'Tombstone',
+ 'id' => ActivityPub::TagManager.instance.uri_for(@status),
+ 'atomUri' => OStatus::TagManager.instance.uri_for(@status),
+ },
+ })
+ )).to have_been_made.once
end
it 'remove status from notifications' do
@@ -78,14 +78,14 @@ RSpec.describe RemoveStatusService, type: :service do
it 'sends Undo activity to followers' do
subject.call(@status)
expect(a_request(:post, 'http://example.com/inbox').with(
- body: hash_including({
- 'type' => 'Undo',
- 'object' => hash_including({
- 'type' => 'Announce',
- 'object' => ActivityPub::TagManager.instance.uri_for(@original_status),
- }),
- })
- )).to have_been_made.once
+ body: hash_including({
+ 'type' => 'Undo',
+ 'object' => hash_including({
+ 'type' => 'Announce',
+ 'object' => ActivityPub::TagManager.instance.uri_for(@original_status),
+ }),
+ })
+ )).to have_been_made.once
end
end
@@ -98,14 +98,14 @@ RSpec.describe RemoveStatusService, type: :service do
it 'sends Undo activity to followers' do
subject.call(@status)
expect(a_request(:post, 'http://example.com/inbox').with(
- body: hash_including({
- 'type' => 'Undo',
- 'object' => hash_including({
- 'type' => 'Announce',
- 'object' => ActivityPub::TagManager.instance.uri_for(@original_status),
- }),
- })
- )).to have_been_made.once
+ body: hash_including({
+ 'type' => 'Undo',
+ 'object' => hash_including({
+ 'type' => 'Announce',
+ 'object' => ActivityPub::TagManager.instance.uri_for(@original_status),
+ }),
+ })
+ )).to have_been_made.once
end
end
end
diff --git a/spec/services/resolve_account_service_spec.rb b/spec/services/resolve_account_service_spec.rb
index 654606bea..1df30ea57 100644
--- a/spec/services/resolve_account_service_spec.rb
+++ b/spec/services/resolve_account_service_spec.rb
@@ -190,7 +190,7 @@ RSpec.describe ResolveAccountService, type: :service do
context 'with an already-known acct: URI changing ActivityPub id' do
let!(:old_account) { Fabricate(:account, username: 'foo', domain: 'ap.example.com', uri: 'https://old.example.com/users/foo', last_webfingered_at: nil) }
- let!(:status) { Fabricate(:status, account: old_account, text: 'foo') }
+ let!(:status) { Fabricate(:status, account: old_account, text: 'foo') }
it 'returns new remote account' do
account = subject.call('foo@ap.example.com')
diff --git a/spec/services/resolve_url_service_spec.rb b/spec/services/resolve_url_service_spec.rb
index b3e3defbf..3598311ee 100644
--- a/spec/services/resolve_url_service_spec.rb
+++ b/spec/services/resolve_url_service_spec.rb
@@ -133,7 +133,7 @@ describe ResolveURLService, type: :service do
let!(:status) { Fabricate(:status, account: poster, visibility: :public) }
let(:url) { 'https://link.to/foobar' }
let(:status_url) { ActivityPub::TagManager.instance.url_for(status) }
- let(:uri) { ActivityPub::TagManager.instance.uri_for(status) }
+ let(:uri) { ActivityPub::TagManager.instance.uri_for(status) }
before do
stub_request(:get, url).to_return(status: 302, headers: { 'Location' => status_url })
diff --git a/spec/services/update_status_service_spec.rb b/spec/services/update_status_service_spec.rb
index 16e981d2b..a7364ca8b 100644
--- a/spec/services/update_status_service_spec.rb
+++ b/spec/services/update_status_service_spec.rb
@@ -111,7 +111,7 @@ RSpec.describe UpdateStatusService, type: :service do
context 'when poll changes' do
let(:account) { Fabricate(:account) }
- let!(:status) { Fabricate(:status, text: 'Foo', account: account, poll_attributes: {options: %w(Foo Bar), account: account, multiple: false, hide_totals: false, expires_at: 7.days.from_now }) }
+ let!(:status) { Fabricate(:status, text: 'Foo', account: account, poll_attributes: { options: %w(Foo Bar), account: account, multiple: false, hide_totals: false, expires_at: 7.days.from_now }) }
let!(:poll) { status.poll }
let!(:voter) { Fabricate(:account) }
diff --git a/spec/support/stories/profile_stories.rb b/spec/support/stories/profile_stories.rb
index 0c4a14d1c..de7ae17e6 100644
--- a/spec/support/stories/profile_stories.rb
+++ b/spec/support/stories/profile_stories.rb
@@ -20,8 +20,8 @@ module ProfileStories
end
def with_alice_as_local_user
- @alice_bio = '@alice and @bob are fictional characters commonly used as'\
- 'placeholder names in #cryptology, as well as #science and'\
+ @alice_bio = '@alice and @bob are fictional characters commonly used as' \
+ 'placeholder names in #cryptology, as well as #science and' \
'engineering 📖 literature. Not affiliated with @pepe.'
@alice = Fabricate(
diff --git a/spec/validators/note_length_validator_spec.rb b/spec/validators/note_length_validator_spec.rb
index 6e9b4e132..390ac8d90 100644
--- a/spec/validators/note_length_validator_spec.rb
+++ b/spec/validators/note_length_validator_spec.rb
@@ -15,7 +15,7 @@ describe NoteLengthValidator do
end
it 'counts URLs as 23 characters flat' do
- text = ('a' * 476) + " http://#{'b' * 30}.com/example"
+ text = ('a' * 476) + " http://#{'b' * 30}.com/example"
account = double(note: text, errors: double(add: nil))
subject.validate_each(account, 'note', text)
@@ -23,7 +23,7 @@ describe NoteLengthValidator do
end
it 'does not count non-autolinkable URLs as 23 characters flat' do
- text = ('a' * 476) + "http://#{'b' * 30}.com/example"
+ text = ('a' * 476) + "http://#{'b' * 30}.com/example"
account = double(note: text, errors: double(add: nil))
subject.validate_each(account, 'note', text)
diff --git a/spec/validators/unreserved_username_validator_spec.rb b/spec/validators/unreserved_username_validator_spec.rb
index 746b3866c..e2f051b08 100644
--- a/spec/validators/unreserved_username_validator_spec.rb
+++ b/spec/validators/unreserved_username_validator_spec.rb
@@ -11,10 +11,10 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
let(:validator) { described_class.new }
let(:account) { double(username: username, errors: errors) }
- let(:errors ) { double(add: nil) }
+ let(:errors) { double(add: nil) }
context '@username.blank?' do
- let(:username) { nil }
+ let(:username) { nil }
it 'not calls errors.add' do
expect(errors).not_to have_received(:add).with(:username, any_args)
@@ -22,7 +22,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
end
context '!@username.blank?' do
- let(:username) { 'f' }
+ let(:username) { 'f' }
context 'reserved_username?' do
let(:reserved_username) { true }
diff --git a/spec/workers/activitypub/distribution_worker_spec.rb b/spec/workers/activitypub/distribution_worker_spec.rb
index 3a5900d9b..7f63e197b 100644
--- a/spec/workers/activitypub/distribution_worker_spec.rb
+++ b/spec/workers/activitypub/distribution_worker_spec.rb
@@ -34,7 +34,7 @@ describe ActivityPub::DistributionWorker do
end
context 'with direct status' do
- let(:mentioned_account) { Fabricate(:account, protocol: :activitypub, inbox_url: 'https://foo.bar/inbox')}
+ let(:mentioned_account) { Fabricate(:account, protocol: :activitypub, inbox_url: 'https://foo.bar/inbox') }
before do
status.update(visibility: :direct)
diff --git a/spec/workers/activitypub/move_distribution_worker_spec.rb b/spec/workers/activitypub/move_distribution_worker_spec.rb
index af8c44cc0..57941065a 100644
--- a/spec/workers/activitypub/move_distribution_worker_spec.rb
+++ b/spec/workers/activitypub/move_distribution_worker_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe ActivityPub::MoveDistributionWorker do
subject { described_class.new }
- let(:migration) { Fabricate(:account_migration) }
+ let(:migration) { Fabricate(:account_migration) }
let(:follower) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example.com') }
let(:blocker) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example2.com') }
@@ -15,9 +15,9 @@ describe ActivityPub::MoveDistributionWorker do
it 'delivers to followers and known blockers' do
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [
- [kind_of(String), migration.account.id, 'http://example.com'],
- [kind_of(String), migration.account.id, 'http://example2.com']
- ])
+ [kind_of(String), migration.account.id, 'http://example.com'],
+ [kind_of(String), migration.account.id, 'http://example2.com']
+ ])
subject.perform(migration.id)
end
end
diff --git a/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb b/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb
index 8f20725c8..8faf04836 100644
--- a/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb
+++ b/spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb
@@ -82,7 +82,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
describe '#get_budget' do
context 'on a single thread' do
- let(:process_set_stub) { [ { 'concurrency' => 1, 'queues' => ['push', 'default'] } ] }
+ let(:process_set_stub) { [{ 'concurrency' => 1, 'queues' => ['push', 'default'] }] }
it 'returns a low value' do
expect(subject.compute_budget).to be < 10
--
cgit
From 54318dcd6d4a22a24c5d8afb7c950bed43df3964 Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Fri, 17 Feb 2023 21:24:16 -0500
Subject: Autofix Rubocop RSpec/ClassCheck (#23685)
---
.rubocop_todo.yml | 14 ---------
spec/lib/settings/extend_spec.rb | 2 +-
spec/models/concerns/account_interactions_spec.rb | 36 +++++++++++------------
spec/models/custom_emoji_filter_spec.rb | 10 +++----
spec/models/session_activation_spec.rb | 4 +--
spec/models/setting_spec.rb | 6 ++--
spec/models/user_role_spec.rb | 4 +--
spec/models/user_spec.rb | 2 +-
8 files changed, 32 insertions(+), 46 deletions(-)
(limited to 'spec/models/concerns/account_interactions_spec.rb')
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index b9971a610..66890b3d7 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -630,20 +630,6 @@ RSpec/Capybara/FeatureMethods:
- 'spec/features/log_in_spec.rb'
- 'spec/features/profile_spec.rb'
-# Offense count: 32
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: be_a, be_kind_of
-RSpec/ClassCheck:
- Exclude:
- - 'spec/lib/settings/extend_spec.rb'
- - 'spec/models/concerns/account_interactions_spec.rb'
- - 'spec/models/custom_emoji_filter_spec.rb'
- - 'spec/models/session_activation_spec.rb'
- - 'spec/models/setting_spec.rb'
- - 'spec/models/user_role_spec.rb'
- - 'spec/models/user_spec.rb'
-
# Offense count: 558
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
diff --git a/spec/lib/settings/extend_spec.rb b/spec/lib/settings/extend_spec.rb
index 83ced4230..ea623137b 100644
--- a/spec/lib/settings/extend_spec.rb
+++ b/spec/lib/settings/extend_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe Settings::Extend do
describe '#settings' do
it 'sets @settings as an instance of Settings::ScopedSettings' do
user = Fabricate(:user)
- expect(user.settings).to be_kind_of Settings::ScopedSettings
+ expect(user.settings).to be_a Settings::ScopedSettings
end
end
end
diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb
index e628384d0..755c71314 100644
--- a/spec/models/concerns/account_interactions_spec.rb
+++ b/spec/models/concerns/account_interactions_spec.rb
@@ -94,7 +94,7 @@ describe AccountInteractions do
describe '#follow!' do
it 'creates and returns Follow' do
expect do
- expect(account.follow!(target_account)).to be_kind_of Follow
+ expect(account.follow!(target_account)).to be_a Follow
end.to change { account.following.count }.by 1
end
end
@@ -102,7 +102,7 @@ describe AccountInteractions do
describe '#block' do
it 'creates and returns Block' do
expect do
- expect(account.block!(target_account)).to be_kind_of Block
+ expect(account.block!(target_account)).to be_a Block
end.to change { account.block_relationships.count }.by 1
end
end
@@ -116,7 +116,7 @@ describe AccountInteractions do
it 'creates Mute, and returns Mute' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.to change { account.mute_relationships.count }.by 1
end
end
@@ -126,7 +126,7 @@ describe AccountInteractions do
it 'creates Mute, and returns Mute' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.to change { account.mute_relationships.count }.by 1
end
end
@@ -136,7 +136,7 @@ describe AccountInteractions do
it 'creates Mute, and returns Mute' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.to change { account.mute_relationships.count }.by 1
end
end
@@ -162,7 +162,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(true)
end
end
@@ -172,7 +172,7 @@ describe AccountInteractions do
it 'returns Mute, and updates mute.hide_notifications false' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.to change { mute.reload.hide_notifications? }.from(true).to(false)
end
end
@@ -182,7 +182,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(true)
end
end
@@ -196,7 +196,7 @@ describe AccountInteractions do
it 'returns Mute, and updates mute.hide_notifications true' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.to change { mute.reload.hide_notifications? }.from(false).to(true)
end
end
@@ -206,7 +206,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(false)
end
end
@@ -216,7 +216,7 @@ describe AccountInteractions do
it 'returns Mute, and updates mute.hide_notifications true' do
expect do
- expect(subject).to be_kind_of Mute
+ expect(subject).to be_a Mute
end.to change { mute.reload.hide_notifications? }.from(false).to(true)
end
end
@@ -231,7 +231,7 @@ describe AccountInteractions do
it 'creates and returns ConversationMute' do
expect do
- is_expected.to be_kind_of ConversationMute
+ is_expected.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_kind_of AccountDomainBlock
+ is_expected.to be_a AccountDomainBlock
end.to change { account.domain_blocks.count }.by 1
end
end
@@ -254,7 +254,7 @@ 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_kind_of Follow
+ is_expected.to be_a Follow
expect(subject).to be_destroyed
end
end
@@ -272,7 +272,7 @@ 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_kind_of Block
+ is_expected.to be_a Block
expect(subject).to be_destroyed
end
end
@@ -290,7 +290,7 @@ 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_kind_of Mute
+ is_expected.to be_a Mute
expect(subject).to be_destroyed
end
end
@@ -310,7 +310,7 @@ describe AccountInteractions do
context 'muting the conversation' do
it 'returns destroyed ConversationMute' do
account.conversation_mutes.create(conversation: conversation)
- is_expected.to be_kind_of ConversationMute
+ is_expected.to be_a ConversationMute
expect(subject).to be_destroyed
end
end
@@ -331,7 +331,7 @@ 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_kind_of AccountDomainBlock
+ is_expected.to be_a AccountDomainBlock
expect(subject).to be_destroyed
end
end
diff --git a/spec/models/custom_emoji_filter_spec.rb b/spec/models/custom_emoji_filter_spec.rb
index 2b1b5dc54..515c0a715 100644
--- a/spec/models/custom_emoji_filter_spec.rb
+++ b/spec/models/custom_emoji_filter_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { local: true } }
it 'returns ActiveRecord::Relation' do
- expect(subject).to be_kind_of(ActiveRecord::Relation)
+ expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_2])
end
end
@@ -24,7 +24,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { remote: true } }
it 'returns ActiveRecord::Relation' do
- expect(subject).to be_kind_of(ActiveRecord::Relation)
+ expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0, custom_emoji_1])
end
end
@@ -33,7 +33,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { by_domain: 'a' } }
it 'returns ActiveRecord::Relation' do
- expect(subject).to be_kind_of(ActiveRecord::Relation)
+ expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0])
end
end
@@ -42,7 +42,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { shortcode: 'hoge' } }
it 'returns ActiveRecord::Relation' do
- expect(subject).to be_kind_of(ActiveRecord::Relation)
+ expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_2])
end
end
@@ -62,7 +62,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { hoge: nil } }
it 'returns ActiveRecord::Relation' do
- expect(subject).to be_kind_of(ActiveRecord::Relation)
+ expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0, custom_emoji_1, custom_emoji_2])
end
end
diff --git a/spec/models/session_activation_spec.rb b/spec/models/session_activation_spec.rb
index 5c3d285cb..26f2b561a 100644
--- a/spec/models/session_activation_spec.rb
+++ b/spec/models/session_activation_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe SessionActivation, type: :model do
let(:session_activation) { Fabricate(:session_activation, user_agent: 'Chrome/62.0.3202.89') }
it 'sets a Browser instance as detection' do
- expect(session_activation.detection).to be_kind_of Browser::Chrome
+ expect(session_activation.detection).to be_a Browser::Chrome
end
end
@@ -80,7 +80,7 @@ RSpec.describe SessionActivation, type: :model do
end
it 'returns an instance of SessionActivation' do
- expect(described_class.activate(**options)).to be_kind_of SessionActivation
+ expect(described_class.activate(**options)).to be_a SessionActivation
end
end
diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb
index 3ccc21d6c..83ba415a8 100644
--- a/spec/models/setting_spec.rb
+++ b/spec/models/setting_spec.rb
@@ -127,7 +127,7 @@ RSpec.describe Setting, type: :model do
let(:records) { [original_setting] }
it 'returns a Hash' do
- expect(described_class.all_as_records).to be_kind_of Hash
+ expect(described_class.all_as_records).to be_a Hash
end
context 'records includes Setting with var as the key' do
@@ -146,7 +146,7 @@ RSpec.describe Setting, type: :model do
it 'includes Setting with value of default_value' do
setting = described_class.all_as_records[key]
- expect(setting).to be_kind_of Setting
+ expect(setting).to be_a Setting
expect(setting).to have_attributes(var: key)
expect(setting).to have_attributes(value: 'default_value')
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_kind_of RailsSettings::Default
+ is_expected.to be_a RailsSettings::Default
end
end
end
diff --git a/spec/models/user_role_spec.rb b/spec/models/user_role_spec.rb
index 7294d14fe..52a8622f9 100644
--- a/spec/models/user_role_spec.rb
+++ b/spec/models/user_role_spec.rb
@@ -127,7 +127,7 @@ RSpec.describe UserRole, type: :model do
subject { described_class.everyone }
it 'returns a role' do
- expect(subject).to be_kind_of(described_class)
+ expect(subject).to be_a(described_class)
end
it 'is identified as the everyone role' do
@@ -147,7 +147,7 @@ RSpec.describe UserRole, type: :model do
subject { described_class.nobody }
it 'returns a role' do
- expect(subject).to be_kind_of(described_class)
+ expect(subject).to be_a(described_class)
end
it 'is identified as the nobody role' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 1f2ab77dc..139d8784b 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -313,7 +313,7 @@ RSpec.describe User, type: :model do
describe 'settings' do
it 'is instance of Settings::ScopedSettings' do
user = Fabricate(:user)
- expect(user.settings).to be_kind_of Settings::ScopedSettings
+ expect(user.settings).to be_a Settings::ScopedSettings
end
end
--
cgit
From b4cbfff3ebf0da3ab0fd76686c71887854a8de87 Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Sat, 18 Feb 2023 06:47:37 -0500
Subject: Autofix Rubocop RSpec/ExcessiveDocstringSpacing (#23666)
---
.rubocop_todo.yml | 7 -------
spec/controllers/settings/migrations_controller_spec.rb | 2 +-
spec/models/concerns/account_interactions_spec.rb | 2 +-
3 files changed, 2 insertions(+), 9 deletions(-)
(limited to 'spec/models/concerns/account_interactions_spec.rb')
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index e7be628ef..f35336332 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -887,13 +887,6 @@ RSpec/EmptyLineAfterSubject:
RSpec/ExampleLength:
Max: 22
-# Offense count: 2
-# This cop supports safe autocorrection (--autocorrect).
-RSpec/ExcessiveDocstringSpacing:
- Exclude:
- - 'spec/controllers/settings/migrations_controller_spec.rb'
- - 'spec/models/concerns/account_interactions_spec.rb'
-
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExpectActual:
diff --git a/spec/controllers/settings/migrations_controller_spec.rb b/spec/controllers/settings/migrations_controller_spec.rb
index 35c5747a0..4ce153c9d 100644
--- a/spec/controllers/settings/migrations_controller_spec.rb
+++ b/spec/controllers/settings/migrations_controller_spec.rb
@@ -90,7 +90,7 @@ describe Settings::MigrationsController do
end
end
- context 'when a recent migration already exists ' do
+ context 'when a recent migration already exists' do
let(:acct) { Fabricate(:account, also_known_as: [ActivityPub::TagManager.instance.uri_for(user.account)]) }
before do
diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb
index 755c71314..b79c44594 100644
--- a/spec/models/concerns/account_interactions_spec.rb
+++ b/spec/models/concerns/account_interactions_spec.rb
@@ -400,7 +400,7 @@ describe AccountInteractions do
subject { account.domain_blocking?(domain) }
context 'blocking the domain' do
- it ' returns true' 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
--
cgit
From 65ba0d92ef78f82a3cf5bf04f13b3d7393da015d Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Sun, 19 Feb 2023 20:33:27 -0500
Subject: Enable Rubocop RSpec/NotToNot (#23723)
---
.rubocop.yml | 3 +
.rubocop_todo.yml | 123 ---------------------
.../activitypub/collections_controller_spec.rb | 4 +-
.../activitypub/inboxes_controller_spec.rb | 6 +-
.../account_moderation_notes_controller_spec.rb | 2 +-
spec/controllers/admin/accounts_controller_spec.rb | 12 +-
.../admin/change_email_controller_spec.rb | 2 +-
.../admin/confirmations_controller_spec.rb | 2 +-
.../admin/domain_blocks_controller_spec.rb | 2 +-
.../admin/report_notes_controller_spec.rb | 4 +-
.../settings/profiles_controller_spec.rb | 2 +-
.../well_known/nodeinfo_controller_spec.rb | 2 +-
spec/lib/activitypub/activity/announce_spec.rb | 2 +-
spec/lib/request_spec.rb | 2 +-
spec/lib/status_filter_spec.rb | 4 +-
spec/lib/text_formatter_spec.rb | 2 +-
spec/models/account_spec.rb | 10 +-
spec/models/concerns/account_interactions_spec.rb | 6 +-
spec/models/concerns/remotable_spec.rb | 4 +-
spec/models/public_feed_spec.rb | 28 ++---
spec/models/setting_spec.rb | 4 +-
spec/models/tag_spec.rb | 6 +-
spec/models/user_spec.rb | 4 +-
spec/services/account_search_service_spec.rb | 2 +-
.../activitypub/process_collection_service_spec.rb | 10 +-
.../process_status_update_service_spec.rb | 4 +-
spec/services/block_domain_service_spec.rb | 6 +-
spec/services/clear_domain_media_service_spec.rb | 6 +-
spec/services/import_service_spec.rb | 2 +-
spec/services/post_status_service_spec.rb | 4 +-
spec/services/search_service_spec.rb | 6 +-
.../validators/blacklisted_email_validator_spec.rb | 2 +-
.../disallowed_hashtags_validator_spec.rb | 4 +-
spec/validators/email_mx_validator_spec.rb | 2 +-
spec/validators/follow_limit_validator_spec.rb | 4 +-
spec/validators/poll_validator_spec.rb | 4 +-
spec/validators/status_length_validator_spec.rb | 4 +-
.../unreserved_username_validator_spec.rb | 4 +-
spec/validators/url_validator_spec.rb | 2 +-
spec/workers/feed_insert_worker_spec.rb | 6 +-
40 files changed, 94 insertions(+), 214 deletions(-)
(limited to 'spec/models/concerns/account_interactions_spec.rb')
diff --git a/.rubocop.yml b/.rubocop.yml
index 3783ccf48..fc1969a64 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -94,6 +94,9 @@ Rails/Exit:
- 'lib/mastodon/cli_helper.rb'
- 'lib/cli.rb'
+RSpec/NotToNot:
+ EnforcedStyle: to_not
+
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 73ebdbfd8..9076891e2 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1440,129 +1440,6 @@ RSpec/NoExpectationExample:
- 'spec/controllers/auth/registrations_controller_spec.rb'
- 'spec/services/precompute_feed_service_spec.rb'
-# Offense count: 370
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: not_to, to_not
-RSpec/NotToNot:
- Exclude:
- - 'spec/config/initializers/rack_attack_spec.rb'
- - 'spec/controllers/accounts_controller_spec.rb'
- - 'spec/controllers/admin/accounts_controller_spec.rb'
- - 'spec/controllers/admin/email_domain_blocks_controller_spec.rb'
- - 'spec/controllers/admin/roles_controller_spec.rb'
- - 'spec/controllers/api/v1/accounts_controller_spec.rb'
- - 'spec/controllers/api/v1/admin/account_actions_controller_spec.rb'
- - 'spec/controllers/api/v1/admin/accounts_controller_spec.rb'
- - 'spec/controllers/api/v1/admin/domain_allows_controller_spec.rb'
- - 'spec/controllers/api/v1/admin/domain_blocks_controller_spec.rb'
- - 'spec/controllers/api/v1/announcements/reactions_controller_spec.rb'
- - 'spec/controllers/api/v1/announcements_controller_spec.rb'
- - 'spec/controllers/api/v1/apps/credentials_controller_spec.rb'
- - 'spec/controllers/api/v1/apps_controller_spec.rb'
- - 'spec/controllers/api/v1/filters_controller_spec.rb'
- - 'spec/controllers/api/v1/media_controller_spec.rb'
- - 'spec/controllers/api/v1/notifications_controller_spec.rb'
- - 'spec/controllers/api/v1/polls/votes_controller_spec.rb'
- - 'spec/controllers/api/v1/reports_controller_spec.rb'
- - 'spec/controllers/api/v1/statuses/mutes_controller_spec.rb'
- - 'spec/controllers/api/v2/filters/keywords_controller_spec.rb'
- - 'spec/controllers/api/v2/filters/statuses_controller_spec.rb'
- - 'spec/controllers/api/v2/filters_controller_spec.rb'
- - 'spec/controllers/auth/challenges_controller_spec.rb'
- - 'spec/controllers/auth/confirmations_controller_spec.rb'
- - 'spec/controllers/auth/passwords_controller_spec.rb'
- - 'spec/controllers/auth/registrations_controller_spec.rb'
- - 'spec/controllers/concerns/challengable_concern_spec.rb'
- - 'spec/controllers/oauth/authorized_applications_controller_spec.rb'
- - 'spec/controllers/oauth/tokens_controller_spec.rb'
- - 'spec/controllers/settings/applications_controller_spec.rb'
- - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb'
- - 'spec/controllers/statuses_controller_spec.rb'
- - 'spec/helpers/application_helper_spec.rb'
- - 'spec/lib/activitypub/activity/announce_spec.rb'
- - 'spec/lib/activitypub/activity/create_spec.rb'
- - 'spec/lib/activitypub/activity/delete_spec.rb'
- - 'spec/lib/activitypub/activity/flag_spec.rb'
- - 'spec/lib/activitypub/dereferencer_spec.rb'
- - 'spec/lib/activitypub/tag_manager_spec.rb'
- - 'spec/lib/delivery_failure_tracker_spec.rb'
- - 'spec/lib/feed_manager_spec.rb'
- - 'spec/lib/html_aware_formatter_spec.rb'
- - 'spec/lib/request_pool_spec.rb'
- - 'spec/lib/status_reach_finder_spec.rb'
- - 'spec/lib/vacuum/access_tokens_vacuum_spec.rb'
- - 'spec/lib/vacuum/backups_vacuum_spec.rb'
- - 'spec/lib/vacuum/media_attachments_vacuum_spec.rb'
- - 'spec/lib/vacuum/preview_cards_vacuum_spec.rb'
- - 'spec/lib/vacuum/statuses_vacuum_spec.rb'
- - 'spec/lib/vacuum/system_keys_vacuum_spec.rb'
- - 'spec/models/account/field_spec.rb'
- - 'spec/models/account_conversation_spec.rb'
- - 'spec/models/account_spec.rb'
- - 'spec/models/account_statuses_cleanup_policy_spec.rb'
- - 'spec/models/account_statuses_filter_spec.rb'
- - 'spec/models/concerns/remotable_spec.rb'
- - 'spec/models/concerns/status_threading_concern_spec.rb'
- - 'spec/models/follow_spec.rb'
- - 'spec/models/media_attachment_spec.rb'
- - 'spec/models/status_spec.rb'
- - 'spec/models/tag_feed_spec.rb'
- - 'spec/models/trends/statuses_spec.rb'
- - 'spec/models/trends/tags_spec.rb'
- - 'spec/models/user_spec.rb'
- - 'spec/models/webhook_spec.rb'
- - 'spec/policies/account_moderation_note_policy_spec.rb'
- - 'spec/policies/account_policy_spec.rb'
- - 'spec/policies/backup_policy_spec.rb'
- - 'spec/policies/custom_emoji_policy_spec.rb'
- - 'spec/policies/domain_block_policy_spec.rb'
- - 'spec/policies/email_domain_block_policy_spec.rb'
- - 'spec/policies/instance_policy_spec.rb'
- - 'spec/policies/invite_policy_spec.rb'
- - 'spec/policies/relay_policy_spec.rb'
- - 'spec/policies/report_note_policy_spec.rb'
- - 'spec/policies/report_policy_spec.rb'
- - 'spec/policies/settings_policy_spec.rb'
- - 'spec/policies/status_policy_spec.rb'
- - 'spec/policies/tag_policy_spec.rb'
- - 'spec/policies/user_policy_spec.rb'
- - 'spec/presenters/familiar_followers_presenter_spec.rb'
- - 'spec/serializers/activitypub/note_spec.rb'
- - 'spec/services/account_statuses_cleanup_service_spec.rb'
- - 'spec/services/activitypub/fetch_remote_status_service_spec.rb'
- - 'spec/services/activitypub/process_account_service_spec.rb'
- - 'spec/services/activitypub/process_status_update_service_spec.rb'
- - 'spec/services/app_sign_up_service_spec.rb'
- - 'spec/services/batched_remove_status_service_spec.rb'
- - 'spec/services/block_domain_service_spec.rb'
- - 'spec/services/bootstrap_timeline_service_spec.rb'
- - 'spec/services/fan_out_on_write_service_spec.rb'
- - 'spec/services/favourite_service_spec.rb'
- - 'spec/services/fetch_link_card_service_spec.rb'
- - 'spec/services/fetch_oembed_service_spec.rb'
- - 'spec/services/fetch_remote_status_service_spec.rb'
- - 'spec/services/follow_service_spec.rb'
- - 'spec/services/mute_service_spec.rb'
- - 'spec/services/notify_service_spec.rb'
- - 'spec/services/remove_status_service_spec.rb'
- - 'spec/services/report_service_spec.rb'
- - 'spec/services/resolve_account_service_spec.rb'
- - 'spec/services/search_service_spec.rb'
- - 'spec/services/suspend_account_service_spec.rb'
- - 'spec/services/unallow_domain_service_spec.rb'
- - 'spec/services/unsuspend_account_service_spec.rb'
- - 'spec/services/update_status_service_spec.rb'
- - 'spec/support/examples/models/concerns/account_avatar.rb'
- - 'spec/support/examples/models/concerns/account_header.rb'
- - 'spec/validators/email_mx_validator_spec.rb'
- - 'spec/validators/note_length_validator_spec.rb'
- - 'spec/validators/reaction_validator_spec.rb'
- - 'spec/validators/status_length_validator_spec.rb'
- - 'spec/validators/unique_username_validator_spec.rb'
- - 'spec/workers/activitypub/fetch_replies_worker_spec.rb'
- - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb'
-
# Offense count: 3
RSpec/PendingWithoutReason:
Exclude:
diff --git a/spec/controllers/activitypub/collections_controller_spec.rb b/spec/controllers/activitypub/collections_controller_spec.rb
index 4e35938db..bf81cdb93 100644
--- a/spec/controllers/activitypub/collections_controller_spec.rb
+++ b/spec/controllers/activitypub/collections_controller_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
end
it 'does not include contents of private pinned status' do
- expect(response.body).not_to include(private_pinned.text)
+ expect(response.body).to_not include(private_pinned.text)
end
context 'when account is permanently suspended' do
@@ -115,7 +115,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
end
it 'does not include contents of private pinned status' do
- expect(response.body).not_to include(private_pinned.text)
+ expect(response.body).to_not include(private_pinned.text)
end
end
diff --git a/spec/controllers/activitypub/inboxes_controller_spec.rb b/spec/controllers/activitypub/inboxes_controller_spec.rb
index 2f023197b..7f4d6b2d3 100644
--- a/spec/controllers/activitypub/inboxes_controller_spec.rb
+++ b/spec/controllers/activitypub/inboxes_controller_spec.rb
@@ -68,7 +68,7 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do
let(:synchronization_collection) { 'https://example.com/followers2' }
it 'does not start a synchronization job' do
- expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async)
+ expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async)
end
end
@@ -76,13 +76,13 @@ RSpec.describe ActivityPub::InboxesController, type: :controller do
let(:synchronization_url) { 'https://example.org/followers' }
it 'does not start a synchronization job' do
- expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async)
+ expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async)
end
end
context 'with matching digest' do
it 'does not start a synchronization job' do
- expect(ActivityPub::FollowersSynchronizationWorker).not_to have_received(:perform_async)
+ expect(ActivityPub::FollowersSynchronizationWorker).to_not have_received(:perform_async)
end
end
diff --git a/spec/controllers/admin/account_moderation_notes_controller_spec.rb b/spec/controllers/admin/account_moderation_notes_controller_spec.rb
index d3f3263f8..b8d606322 100644
--- a/spec/controllers/admin/account_moderation_notes_controller_spec.rb
+++ b/spec/controllers/admin/account_moderation_notes_controller_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe Admin::AccountModerationNotesController, type: :controller do
let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: '' } } }
it 'falls to create a note' do
- expect { subject }.not_to change { AccountModerationNote.count }
+ expect { subject }.to_not change { AccountModerationNote.count }
expect(subject).to render_template 'admin/accounts/show'
end
end
diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb
index 48204b7b6..35d79740a 100644
--- a/spec/controllers/admin/accounts_controller_spec.rb
+++ b/spec/controllers/admin/accounts_controller_spec.rb
@@ -84,7 +84,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'fails to memorialize account' do
is_expected.to have_http_status :forbidden
- expect(account.reload).not_to be_memorial
+ expect(account.reload).to_not be_memorial
end
end
@@ -106,7 +106,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'fails to memorialize account' do
is_expected.to have_http_status :forbidden
- expect(account.reload).not_to be_memorial
+ expect(account.reload).to_not be_memorial
end
end
@@ -115,7 +115,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'fails to memorialize account' do
is_expected.to have_http_status :forbidden
- expect(account.reload).not_to be_memorial
+ expect(account.reload).to_not be_memorial
end
end
end
@@ -133,7 +133,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'succeeds in enabling account' do
is_expected.to redirect_to admin_account_path(account.id)
- expect(user.reload).not_to be_disabled
+ expect(user.reload).to_not be_disabled
end
end
@@ -183,7 +183,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'fails to approve account' do
is_expected.to have_http_status :forbidden
- expect(user.reload).not_to be_approved
+ expect(user.reload).to_not be_approved
end
end
end
@@ -223,7 +223,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'fails to reject account' do
is_expected.to have_http_status :forbidden
- expect(user.reload).not_to be_approved
+ expect(user.reload).to_not be_approved
end
end
end
diff --git a/spec/controllers/admin/change_email_controller_spec.rb b/spec/controllers/admin/change_email_controller_spec.rb
index 0814f327d..520842a19 100644
--- a/spec/controllers/admin/change_email_controller_spec.rb
+++ b/spec/controllers/admin/change_email_controller_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
expect(user.email).to eq previous_email
expect(user.unconfirmed_email).to eq 'test@example.com'
- expect(user.confirmation_token).not_to be_nil
+ expect(user.confirmation_token).to_not be_nil
expect(UserMailer).to have_received(:confirmation_instructions).with(user, user.confirmation_token, { to: 'test@example.com' })
diff --git a/spec/controllers/admin/confirmations_controller_spec.rb b/spec/controllers/admin/confirmations_controller_spec.rb
index 6268903c4..7ca90f3e1 100644
--- a/spec/controllers/admin/confirmations_controller_spec.rb
+++ b/spec/controllers/admin/confirmations_controller_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe Admin::ConfirmationsController, type: :controller do
it 'does not resend confirmation mail' do
expect(subject).to redirect_to admin_accounts_path
expect(flash[:error]).to eq I18n.t('admin.accounts.resend_confirmation.already_confirmed')
- expect(UserMailer).not_to have_received(:confirmation_instructions)
+ expect(UserMailer).to_not have_received(:confirmation_instructions)
end
end
end
diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb
index 3b2fd6c5d..92fc19efa 100644
--- a/spec/controllers/admin/domain_blocks_controller_spec.rb
+++ b/spec/controllers/admin/domain_blocks_controller_spec.rb
@@ -54,7 +54,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
post :create, params: { domain_block: { domain: 'example.com', severity: 'silence' } }
- expect(DomainBlockWorker).not_to have_received(:perform_async)
+ expect(DomainBlockWorker).to_not have_received(:perform_async)
expect(response).to render_template :new
end
diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb
index fa7572d18..8a2603611 100644
--- a/spec/controllers/admin/report_notes_controller_spec.rb
+++ b/spec/controllers/admin/report_notes_controller_spec.rb
@@ -34,7 +34,7 @@ describe Admin::ReportNotesController do
it 'creates a report note and does not resolve report' do
expect { subject }.to change { ReportNote.count }.by(1)
- expect(report.reload).not_to be_action_taken
+ expect(report.reload).to_not be_action_taken
expect(subject).to redirect_to admin_report_path(report)
end
end
@@ -49,7 +49,7 @@ describe Admin::ReportNotesController do
it 'creates a report note and unresolves report' do
expect { subject }.to change { ReportNote.count }.by(1)
- expect(report.reload).not_to be_action_taken
+ expect(report.reload).to_not be_action_taken
expect(subject).to redirect_to admin_report_path(report)
end
end
diff --git a/spec/controllers/settings/profiles_controller_spec.rb b/spec/controllers/settings/profiles_controller_spec.rb
index fbbca8bb9..c7a6ad664 100644
--- a/spec/controllers/settings/profiles_controller_spec.rb
+++ b/spec/controllers/settings/profiles_controller_spec.rb
@@ -38,7 +38,7 @@ RSpec.describe Settings::ProfilesController, type: :controller do
put :update, params: { account: { avatar: fixture_file_upload('avatar.gif', 'image/gif') } }
expect(response).to redirect_to(settings_profile_path)
- expect(account.reload.avatar.instance.avatar_file_name).not_to be_nil
+ expect(account.reload.avatar.instance.avatar_file_name).to_not be_nil
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
end
end
diff --git a/spec/controllers/well_known/nodeinfo_controller_spec.rb b/spec/controllers/well_known/nodeinfo_controller_spec.rb
index 964a14706..e9436cd26 100644
--- a/spec/controllers/well_known/nodeinfo_controller_spec.rb
+++ b/spec/controllers/well_known/nodeinfo_controller_spec.rb
@@ -27,7 +27,7 @@ describe WellKnown::NodeInfoController, type: :controller do
json = body_as_json
- expect({ 'foo' => 0 }).not_to match_json_schema('nodeinfo_2.0')
+ expect({ 'foo' => 0 }).to_not match_json_schema('nodeinfo_2.0')
expect(json).to match_json_schema('nodeinfo_2.0')
expect(json[:version]).to eq '2.0'
expect(json[:usage]).to be_a Hash
diff --git a/spec/lib/activitypub/activity/announce_spec.rb b/spec/lib/activitypub/activity/announce_spec.rb
index 461c3757b..adb13acc2 100644
--- a/spec/lib/activitypub/activity/announce_spec.rb
+++ b/spec/lib/activitypub/activity/announce_spec.rb
@@ -139,7 +139,7 @@ RSpec.describe ActivityPub::Activity::Announce do
end
it 'does not fetch the remote status' do
- expect(a_request(:get, 'https://example.com/actor/hello-world')).not_to have_been_made
+ expect(a_request(:get, 'https://example.com/actor/hello-world')).to_not have_been_made
expect(Status.find_by(uri: 'https://example.com/actor/hello-world')).to be_nil
end
diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb
index e555a8b5a..f63a836de 100644
--- a/spec/lib/request_spec.rb
+++ b/spec/lib/request_spec.rb
@@ -102,7 +102,7 @@ describe Request do
it 'accepts body less than 1 megabyte by default' do
stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.kilobytes))
- expect { subject.perform { |response| response.body_with_limit } }.not_to raise_error
+ expect { subject.perform { |response| response.body_with_limit } }.to_not raise_error
end
it 'rejects body by given size' do
diff --git a/spec/lib/status_filter_spec.rb b/spec/lib/status_filter_spec.rb
index 287fe00de..cdb482059 100644
--- a/spec/lib/status_filter_spec.rb
+++ b/spec/lib/status_filter_spec.rb
@@ -10,7 +10,7 @@ describe StatusFilter do
subject { described_class.new(status, nil) }
context 'when there are no connections' do
- it { is_expected.not_to be_filtered }
+ it { is_expected.to_not be_filtered }
end
context 'when status account is silenced' do
@@ -36,7 +36,7 @@ describe StatusFilter do
subject { described_class.new(status, account) }
context 'when there are no connections' do
- it { is_expected.not_to be_filtered }
+ it { is_expected.to_not be_filtered }
end
context 'when status account is blocked' do
diff --git a/spec/lib/text_formatter_spec.rb b/spec/lib/text_formatter_spec.rb
index d4a3a6b59..cc742b65e 100644
--- a/spec/lib/text_formatter_spec.rb
+++ b/spec/lib/text_formatter_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe TextFormatter do
let(:text) { "line\nfeed" }
it 'removes line feeds' do
- is_expected.not_to include "\n"
+ is_expected.to_not include "\n"
end
end
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 763835618..03ed12d78 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe Account, type: :model do
end
it 'does not raise an error' do
- expect { subject.suspend! }.not_to raise_error
+ expect { subject.suspend! }.to_not raise_error
end
end
end
@@ -206,7 +206,7 @@ RSpec.describe Account, type: :model do
end
it 'calls not ResolveAccountService#call' do
- expect_any_instance_of(ResolveAccountService).not_to receive(:call).with(acct)
+ expect_any_instance_of(ResolveAccountService).to_not receive(:call).with(acct)
account.refresh!
end
end
@@ -811,19 +811,19 @@ RSpec.describe Account, type: :model do
it 'is valid even if the username is longer than 30 characters' do
account = Fabricate.build(:account, domain: 'domain', username: Faker::Lorem.characters(number: 31))
account.valid?
- expect(account).not_to model_have_error_on_field(:username)
+ expect(account).to_not model_have_error_on_field(:username)
end
it 'is valid even if the display name is longer than 30 characters' do
account = Fabricate.build(:account, domain: 'domain', display_name: Faker::Lorem.characters(number: 31))
account.valid?
- expect(account).not_to model_have_error_on_field(:display_name)
+ expect(account).to_not model_have_error_on_field(:display_name)
end
it 'is valid even if the note is longer than 500 characters' do
account = Fabricate.build(:account, domain: 'domain', note: Faker::Lorem.characters(number: 501))
account.valid?
- expect(account).not_to model_have_error_on_field(:note)
+ expect(account).to_not model_have_error_on_field(:note)
end
end
end
diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb
index b79c44594..b2d84308b 100644
--- a/spec/models/concerns/account_interactions_spec.rb
+++ b/spec/models/concerns/account_interactions_spec.rb
@@ -163,7 +163,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_a Mute
- end.not_to change { mute.reload.hide_notifications? }.from(true)
+ end.to_not change { mute.reload.hide_notifications? }.from(true)
end
end
@@ -183,7 +183,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_a Mute
- end.not_to change { mute.reload.hide_notifications? }.from(true)
+ end.to_not change { mute.reload.hide_notifications? }.from(true)
end
end
end
@@ -207,7 +207,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_a Mute
- end.not_to change { mute.reload.hide_notifications? }.from(false)
+ end.to_not change { mute.reload.hide_notifications? }.from(false)
end
end
diff --git a/spec/models/concerns/remotable_spec.rb b/spec/models/concerns/remotable_spec.rb
index ca2d65d2d..964520427 100644
--- a/spec/models/concerns/remotable_spec.rb
+++ b/spec/models/concerns/remotable_spec.rb
@@ -147,8 +147,8 @@ RSpec.describe Remotable do
let(:code) { 500 }
it 'does not assign file' do
- expect(foo).not_to receive(:public_send).with("#{hoge}=", any_args)
- expect(foo).not_to receive(:public_send).with("#{hoge}_file_name=", any_args)
+ expect(foo).to_not receive(:public_send).with("#{hoge}=", any_args)
+ expect(foo).to_not receive(:public_send).with("#{hoge}_file_name=", any_args)
foo.hoge_remote_url = url
end
diff --git a/spec/models/public_feed_spec.rb b/spec/models/public_feed_spec.rb
index 0ffc343f1..be46639c5 100644
--- a/spec/models/public_feed_spec.rb
+++ b/spec/models/public_feed_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe PublicFeed, type: :model do
private_status = Fabricate(:status, visibility: :private)
expect(subject).to include(public_status.id)
- expect(subject).not_to include(private_status.id)
+ expect(subject).to_not include(private_status.id)
end
it 'does not include replies' do
@@ -19,7 +19,7 @@ RSpec.describe PublicFeed, type: :model do
reply = Fabricate(:status, in_reply_to_id: status.id)
expect(subject).to include(status.id)
- expect(subject).not_to include(reply.id)
+ expect(subject).to_not include(reply.id)
end
it 'does not include boosts' do
@@ -27,7 +27,7 @@ RSpec.describe PublicFeed, type: :model do
boost = Fabricate(:status, reblog_of_id: status.id)
expect(subject).to include(status.id)
- expect(subject).not_to include(boost.id)
+ expect(subject).to_not include(boost.id)
end
it 'filters out silenced accounts' do
@@ -36,7 +36,7 @@ RSpec.describe PublicFeed, type: :model do
silenced_status = Fabricate(:status, account: silenced_account)
expect(subject).to include(status.id)
- expect(subject).not_to include(silenced_status.id)
+ expect(subject).to_not include(silenced_status.id)
end
context 'without local_only option' do
@@ -87,7 +87,7 @@ RSpec.describe PublicFeed, type: :model do
it 'does not include remote instances statuses' do
expect(subject).to include(local_status.id)
- expect(subject).not_to include(remote_status.id)
+ expect(subject).to_not include(remote_status.id)
end
end
@@ -96,13 +96,13 @@ RSpec.describe PublicFeed, type: :model do
it 'does not include remote instances statuses' do
expect(subject).to include(local_status.id)
- expect(subject).not_to include(remote_status.id)
+ expect(subject).to_not include(remote_status.id)
end
it 'is not affected by personal domain blocks' do
viewer.block_domain!('test.com')
expect(subject).to include(local_status.id)
- expect(subject).not_to include(remote_status.id)
+ expect(subject).to_not include(remote_status.id)
end
end
end
@@ -119,7 +119,7 @@ RSpec.describe PublicFeed, type: :model do
let(:viewer) { nil }
it 'does not include local instances statuses' do
- expect(subject).not_to include(local_status.id)
+ expect(subject).to_not include(local_status.id)
expect(subject).to include(remote_status.id)
end
end
@@ -128,7 +128,7 @@ RSpec.describe PublicFeed, type: :model do
let(:viewer) { Fabricate(:account, username: 'viewer') }
it 'does not include local instances statuses' do
- expect(subject).not_to include(local_status.id)
+ expect(subject).to_not include(local_status.id)
expect(subject).to include(remote_status.id)
end
end
@@ -146,7 +146,7 @@ RSpec.describe PublicFeed, type: :model do
@account.block!(blocked)
blocked_status = Fabricate(:status, account: blocked)
- expect(subject).not_to include(blocked_status.id)
+ expect(subject).to_not include(blocked_status.id)
end
it 'excludes statuses from accounts who have blocked the account' do
@@ -154,7 +154,7 @@ RSpec.describe PublicFeed, type: :model do
blocker.block!(@account)
blocked_status = Fabricate(:status, account: blocker)
- expect(subject).not_to include(blocked_status.id)
+ expect(subject).to_not include(blocked_status.id)
end
it 'excludes statuses from accounts muted by the account' do
@@ -162,7 +162,7 @@ RSpec.describe PublicFeed, type: :model do
@account.mute!(muted)
muted_status = Fabricate(:status, account: muted)
- expect(subject).not_to include(muted_status.id)
+ expect(subject).to_not include(muted_status.id)
end
it 'excludes statuses from accounts from personally blocked domains' do
@@ -170,7 +170,7 @@ RSpec.describe PublicFeed, type: :model do
@account.block_domain!(blocked.domain)
blocked_status = Fabricate(:status, account: blocked)
- expect(subject).not_to include(blocked_status.id)
+ expect(subject).to_not include(blocked_status.id)
end
context 'with language preferences' do
@@ -182,7 +182,7 @@ RSpec.describe PublicFeed, type: :model do
expect(subject).to include(en_status.id)
expect(subject).to include(es_status.id)
- expect(subject).not_to include(fr_status.id)
+ expect(subject).to_not include(fr_status.id)
end
it 'includes all languages when user does not have a setting' do
diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb
index 83ba415a8..077223094 100644
--- a/spec/models/setting_spec.rb
+++ b/spec/models/setting_spec.rb
@@ -38,7 +38,7 @@ RSpec.describe Setting, type: :model do
let(:cache_value) { 'cache-value' }
it 'calls not RailsSettings::Base#[]' do
- expect(RailsSettings::Base).not_to receive(:[]).with(key)
+ expect(RailsSettings::Base).to_not receive(:[]).with(key)
described_class[key]
end
@@ -104,7 +104,7 @@ RSpec.describe Setting, type: :model do
ActiveSupport::Notifications.subscribed callback, 'sql.active_record' do
described_class[key]
end
- expect(callback).not_to have_received(:call)
+ expect(callback).to_not have_received(:call)
end
it 'returns the cached value' do
diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb
index 102d2f625..7043449c5 100644
--- a/spec/models/tag_spec.rb
+++ b/spec/models/tag_spec.rb
@@ -4,15 +4,15 @@ require 'rails_helper'
RSpec.describe Tag do
describe 'validations' do
it 'invalid with #' do
- expect(described_class.new(name: '#hello_world')).not_to be_valid
+ expect(described_class.new(name: '#hello_world')).to_not be_valid
end
it 'invalid with .' do
- expect(described_class.new(name: '.abcdef123')).not_to be_valid
+ expect(described_class.new(name: '.abcdef123')).to_not be_valid
end
it 'invalid with spaces' do
- expect(described_class.new(name: 'hello world')).not_to be_valid
+ expect(described_class.new(name: 'hello world')).to_not be_valid
end
it 'valid with aesthetic' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index dde1503c0..c2f7e99ac 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -159,7 +159,7 @@ RSpec.describe User, type: :model do
it 'does not trigger the account.approved Web Hook' do
subject
- expect(TriggerWebhookWorker).not_to have_received(:perform_async).with('account.approved', 'Account', user.account_id)
+ expect(TriggerWebhookWorker).to_not have_received(:perform_async).with('account.approved', 'Account', user.account_id)
end
end
@@ -270,7 +270,7 @@ RSpec.describe User, type: :model do
it 'does not trigger the account.approved Web Hook' do
subject
- expect(TriggerWebhookWorker).not_to have_received(:perform_async).with('account.approved', 'Account', user.account_id)
+ expect(TriggerWebhookWorker).to_not have_received(:perform_async).with('account.approved', 'Account', user.account_id)
end
end
end
diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb
index d3b5baad6..45e19d1ef 100644
--- a/spec/services/account_search_service_spec.rb
+++ b/spec/services/account_search_service_spec.rb
@@ -63,7 +63,7 @@ describe AccountSearchService, type: :service do
allow(ResolveAccountService).to receive(:new).and_return(service)
results = subject.call('newuser@remote.com', nil, limit: 10, resolve: false)
- expect(service).not_to have_received(:call)
+ expect(service).to_not have_received(:call)
end
end
diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb
index fbfa6d6c6..d35d9596d 100644
--- a/spec/services/activitypub/process_collection_service_spec.rb
+++ b/spec/services/activitypub/process_collection_service_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
end
it 'does not process payload' do
- expect(ActivityPub::Activity).not_to receive(:factory)
+ expect(ActivityPub::Activity).to_not receive(:factory)
subject.call(json, actor)
end
end
@@ -69,7 +69,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
it 'does not process payload if no signature exists' do
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
- expect(ActivityPub::Activity).not_to receive(:factory)
+ expect(ActivityPub::Activity).to_not receive(:factory)
subject.call(json, forwarder)
end
@@ -87,7 +87,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
payload['signature'] = { 'type' => 'RsaSignature2017' }
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil)
- expect(ActivityPub::Activity).not_to receive(:factory)
+ expect(ActivityPub::Activity).to_not receive(:factory)
subject.call(json, forwarder)
end
@@ -206,7 +206,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
end
it 'does not process forged payload' do
- expect(ActivityPub::Activity).not_to receive(:factory).with(
+ expect(ActivityPub::Activity).to_not receive(:factory).with(
hash_including(
'object' => hash_including(
'id' => 'https://example.com/users/bob/fake-status'
@@ -216,7 +216,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
anything
)
- expect(ActivityPub::Activity).not_to receive(:factory).with(
+ expect(ActivityPub::Activity).to_not receive(:factory).with(
hash_including(
'object' => hash_including(
'content' => '
puck was here
'
diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb
index 5d15f6ffe..ae7db88bf 100644
--- a/spec/services/activitypub/process_status_update_service_spec.rb
+++ b/spec/services/activitypub/process_status_update_service_spec.rb
@@ -214,11 +214,11 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
it 'does not create any edits' do
- expect { subject.call(status, json) }.not_to change { status.reload.edits.pluck(&:id) }
+ expect { subject.call(status, json) }.to_not change { status.reload.edits.pluck(&:id) }
end
it 'does not update the text, spoiler_text or edited_at' do
- expect { subject.call(status, json) }.not_to change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
+ expect { subject.call(status, json) }.to_not change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
end
end
diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb
index 242b02fff..e24e48d41 100644
--- a/spec/services/block_domain_service_spec.rb
+++ b/spec/services/block_domain_service_spec.rb
@@ -67,9 +67,9 @@ RSpec.describe BlockDomainService, type: :service do
end
it 'leaves the domains status and attachments, but clears media' do
- expect { bad_status1.reload }.not_to raise_error
- expect { bad_status2.reload }.not_to raise_error
- expect { bad_attachment.reload }.not_to raise_error
+ expect { bad_status1.reload }.to_not raise_error
+ expect { bad_status2.reload }.to_not raise_error
+ expect { bad_attachment.reload }.to_not raise_error
expect(bad_attachment.file.exists?).to be false
end
end
diff --git a/spec/services/clear_domain_media_service_spec.rb b/spec/services/clear_domain_media_service_spec.rb
index 45b92e2c9..e90faf84d 100644
--- a/spec/services/clear_domain_media_service_spec.rb
+++ b/spec/services/clear_domain_media_service_spec.rb
@@ -14,9 +14,9 @@ RSpec.describe ClearDomainMediaService, type: :service do
end
it 'leaves the domains status and attachments, but clears media' do
- expect { bad_status1.reload }.not_to raise_error
- expect { bad_status2.reload }.not_to raise_error
- expect { bad_attachment.reload }.not_to raise_error
+ expect { bad_status1.reload }.to_not raise_error
+ expect { bad_status2.reload }.to_not raise_error
+ expect { bad_attachment.reload }.to_not raise_error
expect(bad_attachment.file.exists?).to be false
end
end
diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb
index a12148833..2b1516ff0 100644
--- a/spec/services/import_service_spec.rb
+++ b/spec/services/import_service_spec.rb
@@ -234,7 +234,7 @@ RSpec.describe ImportService, type: :service do
subject.call(import)
expect(account.bookmarks.map(&:status).map(&:id)).to include(local_status.id)
expect(account.bookmarks.map(&:status).map(&:id)).to include(remote_status.id)
- expect(account.bookmarks.map(&:status).map(&:id)).not_to include(direct_status.id)
+ expect(account.bookmarks.map(&:status).map(&:id)).to_not include(direct_status.id)
expect(account.bookmarks.count).to eq 3
end
end
diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb
index 0b72253a5..2148f1819 100644
--- a/spec/services/post_status_service_spec.rb
+++ b/spec/services/post_status_service_spec.rb
@@ -50,7 +50,7 @@ RSpec.describe PostStatusService, type: :service do
end
it 'does not change statuses count' do
- expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.not_to change { [account.statuses_count, previous_status.replies_count] }
+ expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.to_not change { [account.statuses_count, previous_status.replies_count] }
end
end
@@ -157,7 +157,7 @@ RSpec.describe PostStatusService, type: :service do
expect do
subject.call(account, text: '@alice @alice @alice hey @alice')
- end.not_to raise_error
+ end.to_not raise_error
end
it 'processes hashtags' do
diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb
index 6f32007e8..7ec334a56 100644
--- a/spec/services/search_service_spec.rb
+++ b/spec/services/search_service_spec.rb
@@ -13,8 +13,8 @@ describe SearchService, type: :service do
results = subject.call('', nil, 10)
expect(results).to eq(empty_results)
- expect(AccountSearchService).not_to have_received(:new)
- expect(Tag).not_to have_received(:search_for)
+ expect(AccountSearchService).to_not have_received(:new)
+ expect(Tag).to_not have_received(:search_for)
end
end
@@ -89,7 +89,7 @@ describe SearchService, type: :service do
allow(Tag).to receive(:search_for)
results = subject.call(query, nil, 10)
- expect(Tag).not_to have_received(:search_for)
+ expect(Tag).to_not have_received(:search_for)
expect(results).to eq empty_results
end
diff --git a/spec/validators/blacklisted_email_validator_spec.rb b/spec/validators/blacklisted_email_validator_spec.rb
index f9ee3b932..cb807fe24 100644
--- a/spec/validators/blacklisted_email_validator_spec.rb
+++ b/spec/validators/blacklisted_email_validator_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do
let(:blocked_email) { false }
it 'does not add errors' do
- expect(subject).not_to have_received(:add).with(:email, :blocked)
+ expect(subject).to_not have_received(:add).with(:email, :blocked)
end
context 'when canonical e-mail is blocked' do
diff --git a/spec/validators/disallowed_hashtags_validator_spec.rb b/spec/validators/disallowed_hashtags_validator_spec.rb
index 9deec0bb9..2c4ebc4f2 100644
--- a/spec/validators/disallowed_hashtags_validator_spec.rb
+++ b/spec/validators/disallowed_hashtags_validator_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do
let(:reblog) { true }
it 'does not add errors' do
- expect(errors).not_to have_received(:add).with(:text, any_args)
+ expect(errors).to_not have_received(:add).with(:text, any_args)
end
end
@@ -31,7 +31,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do
let(:disallowed_tags) { [] }
it 'does not add errors' do
- expect(errors).not_to have_received(:add).with(:text, any_args)
+ expect(errors).to_not have_received(:add).with(:text, any_args)
end
end
diff --git a/spec/validators/email_mx_validator_spec.rb b/spec/validators/email_mx_validator_spec.rb
index 6640d6058..ffb6851d0 100644
--- a/spec/validators/email_mx_validator_spec.rb
+++ b/spec/validators/email_mx_validator_spec.rb
@@ -38,7 +38,7 @@ describe EmailMxValidator do
allow(Resolv::DNS).to receive(:open).and_yield(resolver)
subject.validate(user)
- expect(user.errors).not_to have_received(:add)
+ expect(user.errors).to_not have_received(:add)
end
it 'adds an error if the email domain name contains empty labels' do
diff --git a/spec/validators/follow_limit_validator_spec.rb b/spec/validators/follow_limit_validator_spec.rb
index cc8fbb631..94ba0c47f 100644
--- a/spec/validators/follow_limit_validator_spec.rb
+++ b/spec/validators/follow_limit_validator_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe FollowLimitValidator, type: :validator do
let(:_nil) { true }
it 'not calls errors.add' do
- expect(errors).not_to have_received(:add).with(:base, any_args)
+ expect(errors).to_not have_received(:add).with(:base, any_args)
end
end
@@ -43,7 +43,7 @@ RSpec.describe FollowLimitValidator, type: :validator do
let(:limit_reached) { false }
it 'not calls errors.add' do
- expect(errors).not_to have_received(:add).with(:base, any_args)
+ expect(errors).to_not have_received(:add).with(:base, any_args)
end
end
end
diff --git a/spec/validators/poll_validator_spec.rb b/spec/validators/poll_validator_spec.rb
index a76c63ccc..f3f4b1288 100644
--- a/spec/validators/poll_validator_spec.rb
+++ b/spec/validators/poll_validator_spec.rb
@@ -15,14 +15,14 @@ RSpec.describe PollValidator, type: :validator do
let(:expires_at) { 1.day.from_now }
it 'have no errors' do
- expect(errors).not_to have_received(:add)
+ expect(errors).to_not have_received(:add)
end
context 'expires just 5 min ago' do
let(:expires_at) { 5.minutes.from_now }
it 'not calls errors add' do
- expect(errors).not_to have_received(:add)
+ expect(errors).to_not have_received(:add)
end
end
end
diff --git a/spec/validators/status_length_validator_spec.rb b/spec/validators/status_length_validator_spec.rb
index db9c728a8..e132b5618 100644
--- a/spec/validators/status_length_validator_spec.rb
+++ b/spec/validators/status_length_validator_spec.rb
@@ -7,13 +7,13 @@ describe StatusLengthValidator do
it 'does not add errors onto remote statuses' do
status = double(local?: false)
subject.validate(status)
- expect(status).not_to receive(:errors)
+ expect(status).to_not receive(:errors)
end
it 'does not add errors onto local reblogs' do
status = double(local?: false, reblog?: true)
subject.validate(status)
- expect(status).not_to receive(:errors)
+ expect(status).to_not receive(:errors)
end
it 'adds an error when content warning is over 500 characters' do
diff --git a/spec/validators/unreserved_username_validator_spec.rb b/spec/validators/unreserved_username_validator_spec.rb
index e2f051b08..3c6f71c59 100644
--- a/spec/validators/unreserved_username_validator_spec.rb
+++ b/spec/validators/unreserved_username_validator_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
let(:username) { nil }
it 'not calls errors.add' do
- expect(errors).not_to have_received(:add).with(:username, any_args)
+ expect(errors).to_not have_received(:add).with(:username, any_args)
end
end
@@ -36,7 +36,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
let(:reserved_username) { false }
it 'not calls errors.add' do
- expect(errors).not_to have_received(:add).with(:username, any_args)
+ expect(errors).to_not have_received(:add).with(:username, any_args)
end
end
end
diff --git a/spec/validators/url_validator_spec.rb b/spec/validators/url_validator_spec.rb
index 85eadeb63..966261b50 100644
--- a/spec/validators/url_validator_spec.rb
+++ b/spec/validators/url_validator_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe URLValidator, type: :validator do
let(:compliant) { true }
it 'not calls errors.add' do
- expect(errors).not_to have_received(:add).with(attribute, any_args)
+ expect(errors).to_not have_received(:add).with(attribute, any_args)
end
end
end
diff --git a/spec/workers/feed_insert_worker_spec.rb b/spec/workers/feed_insert_worker_spec.rb
index fb34970fc..1a723d63a 100644
--- a/spec/workers/feed_insert_worker_spec.rb
+++ b/spec/workers/feed_insert_worker_spec.rb
@@ -16,7 +16,7 @@ describe FeedInsertWorker do
result = subject.perform(nil, follower.id)
expect(result).to eq true
- expect(instance).not_to have_received(:push_to_home)
+ expect(instance).to_not have_received(:push_to_home)
end
it 'skips push with missing account' do
@@ -25,7 +25,7 @@ describe FeedInsertWorker do
result = subject.perform(status.id, nil)
expect(result).to eq true
- expect(instance).not_to have_received(:push_to_home)
+ expect(instance).to_not have_received(:push_to_home)
end
end
@@ -36,7 +36,7 @@ describe FeedInsertWorker do
result = subject.perform(status.id, follower.id)
expect(result).to be_nil
- expect(instance).not_to have_received(:push_to_home)
+ expect(instance).to_not have_received(:push_to_home)
end
it 'pushes the status onto the home timeline without filter' do
--
cgit
From 38a1d8bb85da6c7a52a3bde28af368b8d2104d02 Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Sun, 19 Feb 2023 23:00:48 -0500
Subject: Autofix Rubocop RSpec/ImplicitSubject (#23721)
---
.rubocop_todo.yml | 86 +++++++---------------
app/serializers/initial_state_serializer.rb | 1 -
spec/controllers/admin/accounts_controller_spec.rb | 32 ++++----
.../controllers/admin/instances_controller_spec.rb | 4 +-
spec/controllers/application_controller_spec.rb | 2 +-
spec/controllers/home_controller_spec.rb | 4 +-
spec/controllers/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 ++++++++++----------
spec/models/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(-)
(limited to 'spec/models/concerns/account_interactions_spec.rb')
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(/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) { '
'
end
end
@@ -22,7 +24,7 @@ RSpec.describe AdvancedTextFormatter do
let(:text) { "line\nfeed" }
it 'removes line feeds' do
- is_expected.not_to include "\n"
+ expect(subject).to_not include "\n"
end
end
@@ -30,7 +32,7 @@ RSpec.describe AdvancedTextFormatter do
let(:text) { 'test `foo` bar' }
it 'formats code using ' do
- is_expected.to include 'test foo bar'
+ expect(subject).to include 'test foo bar'
end
end
@@ -38,15 +40,15 @@ RSpec.describe AdvancedTextFormatter do
let(:text) { "test\n\n```\nint main(void) {\n return 0; // https://joinmastodon.org/foo\n}\n```\n" }
it 'formats code using
and ' do
- is_expected.to include '
int main'
+ expect(subject).to include '
int main'
end
it 'does not strip leading spaces' do
- is_expected.to include '> return 0'
+ expect(subject).to include '> return 0'
end
it 'does not format links' do
- is_expected.to include 'return 0; // https://joinmastodon.org/foo'
+ expect(subject).to include 'return 0; // https://joinmastodon.org/foo'
end
end
@@ -54,7 +56,7 @@ RSpec.describe AdvancedTextFormatter do
let(:text) { 'test `https://foo.bar/bar` bar' }
it 'does not rewrite the link' do
- is_expected.to include 'test https://foo.bar/bar bar'
+ expect(subject).to include 'test https://foo.bar/bar bar'
end
end
@@ -62,7 +64,7 @@ RSpec.describe AdvancedTextFormatter do
let(:text) { 'foo https://cb6e6126.ngrok.io/about/more' }
it 'creates a link' do
- is_expected.to include '@alice'
+ expect(subject).to include '@alice'
end
end
@@ -80,7 +82,7 @@ RSpec.describe AdvancedTextFormatter do
let(:text) { '@alice' }
it 'does not create a mention link' do
- is_expected.to include '@alice'
+ expect(subject).to include '@alice'
end
end
@@ -88,7 +90,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -96,7 +98,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -104,7 +106,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -112,11 +114,11 @@ RSpec.describe AdvancedTextFormatter 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
@@ -124,7 +126,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -132,7 +134,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -140,7 +142,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -148,7 +150,7 @@ RSpec.describe AdvancedTextFormatter 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
end
@@ -157,7 +159,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -166,7 +168,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -174,7 +176,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -182,7 +184,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -190,7 +192,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -198,7 +200,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -206,7 +208,7 @@ RSpec.describe AdvancedTextFormatter 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
@@ -214,19 +216,19 @@ RSpec.describe AdvancedTextFormatter 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
context 'given a URL containing unsafe code (XSS attack, invisible part)' do
- let(:text) { %q{http://example.com/blahblahblahblah/a} }
+ 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 'does not include a script tag' do
- is_expected.to_not include '' }
it 'does not include a script tag' do
- is_expected.to_not include '