From c0d7c855b3f6865f16c909e803093cebbc3bd709 Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Sat, 18 Feb 2023 16:59:00 -0500
Subject: Autofix Rubocop RSpec/Capybara/FeatureMethods (#23708)
---
spec/features/log_in_spec.rb | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
(limited to 'spec/features/log_in_spec.rb')
diff --git a/spec/features/log_in_spec.rb b/spec/features/log_in_spec.rb
index de1a6de03..329cdf34c 100644
--- a/spec/features/log_in_spec.rb
+++ b/spec/features/log_in_spec.rb
@@ -2,21 +2,21 @@
require 'rails_helper'
-feature 'Log in' do
+describe 'Log in' do
include ProfileStories
- given(:email) { "test@example.com" }
- given(:password) { "password" }
- given(:confirmed_at) { Time.zone.now }
+ subject { page }
+
+ let(:email) { "test@example.com" }
+ let(:password) { "password" }
+ let(:confirmed_at) { Time.zone.now }
- background do
+ before do
as_a_registered_user
visit new_user_session_path
end
- subject { page }
-
- scenario 'A valid email and password user is able to log in' do
+ it 'A valid email and password user is able to log in' do
fill_in 'user_email', with: email
fill_in 'user_password', with: password
click_on I18n.t('auth.login')
@@ -24,7 +24,7 @@ feature 'Log in' do
is_expected.to have_css('div.app-holder')
end
- scenario 'A invalid email and password user is not able to log in' do
+ it 'A invalid email and password user is not able to log in' do
fill_in 'user_email', with: 'invalid_email'
fill_in 'user_password', with: 'invalid_password'
click_on I18n.t('auth.login')
@@ -33,9 +33,9 @@ feature 'Log in' do
end
context do
- given(:confirmed_at) { nil }
+ let(:confirmed_at) { nil }
- scenario 'A unconfirmed user is able to log in' do
+ it 'A unconfirmed user is able to log in' do
fill_in 'user_email', with: email
fill_in 'user_password', with: password
click_on I18n.t('auth.login')
--
cgit
From 81ad6c2e39393ff20450385cb37dd9bf6e6651e5 Mon Sep 17 00:00:00 2001
From: Nick Schonning
Date: Sat, 18 Feb 2023 17:38:14 -0500
Subject: Autofix Rubocop Style/StringLiterals (#23695)
---
.rubocop_todo.yml | 82 ----------------------
app/lib/webfinger.rb | 4 +-
db/migrate/20160305115639_add_devise_to_users.rb | 2 +-
.../20161122163057_remove_unneeded_indexes.rb | 6 +-
.../20170125145934_add_spoiler_text_to_statuses.rb | 2 +-
...1212195226_remove_duplicate_indexes_in_lists.rb | 4 +-
...uses_for_api_v1_accounts_account_id_statuses.rb | 4 +-
db/migrate/20180617162849_remove_unused_indexes.rb | 6 +-
...80606_encrypted_message_ids_to_timestamp_ids.rb | 2 +-
...213645_media_attachment_ids_to_timestamp_ids.rb | 2 +-
.../20210306164523_account_ids_to_timestamp_ids.rb | 2 +-
lib/mastodon/emoji_cli.rb | 2 +-
lib/rails/engine_extensions.rb | 2 +-
lib/tasks/mastodon.rake | 2 +-
.../admin/change_email_controller_spec.rb | 8 +--
.../api/v1/streaming_controller_spec.rb | 2 +-
spec/controllers/application_controller_spec.rb | 4 +-
.../auth/registrations_controller_spec.rb | 20 +++---
spec/controllers/auth/sessions_controller_spec.rb | 28 ++++----
.../authorized_applications_controller_spec.rb | 2 +-
.../settings/imports_controller_spec.rb | 4 +-
.../settings/profiles_controller_spec.rb | 4 +-
.../webauthn_credentials_controller_spec.rb | 2 +-
.../statuses_cleanup_controller_spec.rb | 4 +-
.../well_known/nodeinfo_controller_spec.rb | 4 +-
.../account_moderation_note_fabricator.rb | 2 +-
spec/fabricators/account_note_fabricator.rb | 2 +-
spec/fabricators/account_stat_fabricator.rb | 6 +-
spec/fabricators/account_tag_stat_fabricator.rb | 2 +-
.../account_warning_preset_fabricator.rb | 2 +-
spec/fabricators/admin_action_log_fabricator.rb | 2 +-
.../canonical_email_block_fabricator.rb | 2 +-
.../fabricators/conversation_account_fabricator.rb | 2 +-
.../custom_emoji_category_fabricator.rb | 2 +-
spec/fabricators/domain_allow_fabricator.rb | 2 +-
spec/fabricators/encrypted_message_fabricator.rb | 4 +-
spec/fabricators/identity_fabricator.rb | 4 +-
spec/fabricators/ip_block_fabricator.rb | 8 +--
spec/fabricators/list_fabricator.rb | 2 +-
spec/fabricators/relay_fabricator.rb | 2 +-
spec/fabricators/report_fabricator.rb | 2 +-
spec/fabricators/report_note_fabricator.rb | 2 +-
spec/fabricators/session_activation_fabricator.rb | 2 +-
spec/fabricators/status_edit_fabricator.rb | 4 +-
spec/fabricators/status_fabricator.rb | 2 +-
spec/fabricators/status_stat_fabricator.rb | 6 +-
spec/fabricators/user_fabricator.rb | 2 +-
spec/fabricators/user_role_fabricator.rb | 4 +-
spec/features/log_in_spec.rb | 4 +-
spec/helpers/accounts_helper_spec.rb | 8 +--
spec/helpers/application_helper_spec.rb | 10 +--
spec/lib/feed_manager_spec.rb | 2 +-
spec/mailers/notification_mailer_spec.rb | 44 ++++++------
spec/mailers/user_mailer_spec.rb | 2 +-
spec/models/account_spec.rb | 58 +++++++--------
spec/models/media_attachment_spec.rb | 22 +++---
spec/models/web/push_subscription_spec.rb | 2 +-
spec/models/webauthn_credentials_spec.rb | 4 +-
spec/presenters/instance_presenter_spec.rb | 30 ++++----
spec/rails_helper.rb | 2 +-
spec/requests/catch_all_route_request_spec.rb | 20 +++---
spec/requests/host_meta_request_spec.rb | 10 +--
spec/requests/localization_spec.rb | 6 +-
spec/services/account_search_service_spec.rb | 2 +-
.../fetch_remote_status_service_spec.rb | 40 +++++------
spec/services/delete_account_service_spec.rb | 12 ++--
spec/services/favourite_service_spec.rb | 4 +-
spec/services/fetch_link_card_service_spec.rb | 8 +--
spec/services/fetch_oembed_service_spec.rb | 6 +-
spec/services/fetch_remote_status_service_spec.rb | 2 +-
spec/services/follow_service_spec.rb | 2 +-
spec/services/import_service_spec.rb | 4 +-
spec/services/post_status_service_spec.rb | 28 ++++----
spec/services/process_mentions_service_spec.rb | 8 +--
spec/services/resolve_account_service_spec.rb | 18 ++---
spec/spec_helper.rb | 6 +-
76 files changed, 277 insertions(+), 359 deletions(-)
(limited to 'spec/features/log_in_spec.rb')
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 1c22c440b..e99747819 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -3057,88 +3057,6 @@ Style/StringConcatenation:
- 'spec/validators/disallowed_hashtags_validator_spec.rb'
- 'spec/workers/web/push_notification_worker_spec.rb'
-# Offense count: 297
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
-# SupportedStyles: single_quotes, double_quotes
-Style/StringLiterals:
- Exclude:
- - 'app/lib/webfinger.rb'
- - 'db/migrate/20160305115639_add_devise_to_users.rb'
- - 'db/migrate/20161122163057_remove_unneeded_indexes.rb'
- - 'db/migrate/20170125145934_add_spoiler_text_to_statuses.rb'
- - 'db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb'
- - 'db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb'
- - 'db/migrate/20180617162849_remove_unused_indexes.rb'
- - 'db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb'
- - 'db/migrate/20200622213645_media_attachment_ids_to_timestamp_ids.rb'
- - 'db/migrate/20210306164523_account_ids_to_timestamp_ids.rb'
- - 'lib/mastodon/emoji_cli.rb'
- - 'lib/rails/engine_extensions.rb'
- - 'lib/tasks/mastodon.rake'
- - 'spec/controllers/admin/change_email_controller_spec.rb'
- - 'spec/controllers/api/v1/streaming_controller_spec.rb'
- - 'spec/controllers/application_controller_spec.rb'
- - 'spec/controllers/auth/registrations_controller_spec.rb'
- - 'spec/controllers/auth/sessions_controller_spec.rb'
- - 'spec/controllers/oauth/authorized_applications_controller_spec.rb'
- - 'spec/controllers/settings/imports_controller_spec.rb'
- - 'spec/controllers/settings/profiles_controller_spec.rb'
- - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb'
- - 'spec/controllers/statuses_cleanup_controller_spec.rb'
- - 'spec/controllers/well_known/nodeinfo_controller_spec.rb'
- - 'spec/fabricators/account_moderation_note_fabricator.rb'
- - 'spec/fabricators/account_note_fabricator.rb'
- - 'spec/fabricators/account_stat_fabricator.rb'
- - 'spec/fabricators/account_tag_stat_fabricator.rb'
- - 'spec/fabricators/account_warning_preset_fabricator.rb'
- - 'spec/fabricators/admin_action_log_fabricator.rb'
- - 'spec/fabricators/canonical_email_block_fabricator.rb'
- - 'spec/fabricators/conversation_account_fabricator.rb'
- - 'spec/fabricators/custom_emoji_category_fabricator.rb'
- - 'spec/fabricators/domain_allow_fabricator.rb'
- - 'spec/fabricators/encrypted_message_fabricator.rb'
- - 'spec/fabricators/identity_fabricator.rb'
- - 'spec/fabricators/ip_block_fabricator.rb'
- - 'spec/fabricators/list_fabricator.rb'
- - 'spec/fabricators/relay_fabricator.rb'
- - 'spec/fabricators/report_fabricator.rb'
- - 'spec/fabricators/report_note_fabricator.rb'
- - 'spec/fabricators/session_activation_fabricator.rb'
- - 'spec/fabricators/status_edit_fabricator.rb'
- - 'spec/fabricators/status_fabricator.rb'
- - 'spec/fabricators/status_stat_fabricator.rb'
- - 'spec/fabricators/user_fabricator.rb'
- - 'spec/fabricators/user_role_fabricator.rb'
- - 'spec/features/log_in_spec.rb'
- - 'spec/helpers/accounts_helper_spec.rb'
- - 'spec/helpers/application_helper_spec.rb'
- - 'spec/lib/feed_manager_spec.rb'
- - 'spec/mailers/notification_mailer_spec.rb'
- - 'spec/mailers/user_mailer_spec.rb'
- - 'spec/models/account_spec.rb'
- - 'spec/models/media_attachment_spec.rb'
- - 'spec/models/web/push_subscription_spec.rb'
- - 'spec/models/webauthn_credentials_spec.rb'
- - 'spec/presenters/instance_presenter_spec.rb'
- - 'spec/rails_helper.rb'
- - 'spec/requests/catch_all_route_request_spec.rb'
- - 'spec/requests/host_meta_request_spec.rb'
- - 'spec/requests/localization_spec.rb'
- - 'spec/services/account_search_service_spec.rb'
- - 'spec/services/activitypub/fetch_remote_status_service_spec.rb'
- - 'spec/services/delete_account_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/import_service_spec.rb'
- - 'spec/services/post_status_service_spec.rb'
- - 'spec/services/process_mentions_service_spec.rb'
- - 'spec/services/resolve_account_service_spec.rb'
- - 'spec/spec_helper.rb'
-
# Offense count: 272
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, MinSize.
diff --git a/app/lib/webfinger.rb b/app/lib/webfinger.rb
index 7c0c10c33..42ddef47b 100644
--- a/app/lib/webfinger.rb
+++ b/app/lib/webfinger.rb
@@ -99,7 +99,7 @@ class Webfinger
end
def standard_url
- if @domain.end_with? ".onion"
+ if @domain.end_with? '.onion'
"http://#{@domain}/.well-known/webfinger?resource=#{@uri}"
else
"https://#{@domain}/.well-known/webfinger?resource=#{@uri}"
@@ -107,7 +107,7 @@ class Webfinger
end
def host_meta_url
- if @domain.end_with? ".onion"
+ if @domain.end_with? '.onion'
"http://#{@domain}/.well-known/host-meta"
else
"https://#{@domain}/.well-known/host-meta"
diff --git a/db/migrate/20160305115639_add_devise_to_users.rb b/db/migrate/20160305115639_add_devise_to_users.rb
index 0e12e6053..fa1e521b2 100644
--- a/db/migrate/20160305115639_add_devise_to_users.rb
+++ b/db/migrate/20160305115639_add_devise_to_users.rb
@@ -2,7 +2,7 @@ class AddDeviseToUsers < ActiveRecord::Migration[4.2]
def self.up
change_table(:users) do |t|
## Database authenticatable
- t.string :encrypted_password, null: false, default: ""
+ t.string :encrypted_password, null: false, default: ''
## Recoverable
t.string :reset_password_token
diff --git a/db/migrate/20161122163057_remove_unneeded_indexes.rb b/db/migrate/20161122163057_remove_unneeded_indexes.rb
index 3832b878d..12cc9c5b2 100644
--- a/db/migrate/20161122163057_remove_unneeded_indexes.rb
+++ b/db/migrate/20161122163057_remove_unneeded_indexes.rb
@@ -1,7 +1,7 @@
class RemoveUnneededIndexes < ActiveRecord::Migration[5.0]
def change
- remove_index :notifications, name: "index_notifications_on_account_id"
- remove_index :settings, name: "index_settings_on_target_type_and_target_id"
- remove_index :statuses_tags, name: "index_statuses_tags_on_tag_id"
+ remove_index :notifications, name: 'index_notifications_on_account_id'
+ remove_index :settings, name: 'index_settings_on_target_type_and_target_id'
+ remove_index :statuses_tags, name: 'index_statuses_tags_on_tag_id'
end
end
diff --git a/db/migrate/20170125145934_add_spoiler_text_to_statuses.rb b/db/migrate/20170125145934_add_spoiler_text_to_statuses.rb
index 2c43210ba..39cd41c00 100644
--- a/db/migrate/20170125145934_add_spoiler_text_to_statuses.rb
+++ b/db/migrate/20170125145934_add_spoiler_text_to_statuses.rb
@@ -1,5 +1,5 @@
class AddSpoilerTextToStatuses < ActiveRecord::Migration[5.0]
def change
- add_column :statuses, :spoiler_text, :text, default: "", null: false
+ add_column :statuses, :spoiler_text, :text, default: '', null: false
end
end
diff --git a/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb b/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb
index 03f2591a8..ba67eee86 100644
--- a/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb
+++ b/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb
@@ -1,6 +1,6 @@
class RemoveDuplicateIndexesInLists < ActiveRecord::Migration[5.1]
def change
- remove_index :list_accounts, name: "index_list_accounts_on_account_id"
- remove_index :list_accounts, name: "index_list_accounts_on_list_id"
+ remove_index :list_accounts, name: 'index_list_accounts_on_account_id'
+ remove_index :list_accounts, name: 'index_list_accounts_on_list_id'
end
end
diff --git a/db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb b/db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb
index ccd2ec7ea..e23880bf5 100644
--- a/db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb
+++ b/db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb
@@ -5,11 +5,11 @@ class RevertIndexChangeOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecor
def change
safety_assured do
- add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 unless index_name_exists?(:statuses, "index_statuses_20180106")
+ add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 unless index_name_exists?(:statuses, 'index_statuses_20180106')
end
# These index may not exists (see migration 20180514130000)
remove_index :statuses, column: [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently if index_exists?(:statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)')
- remove_index :statuses, column: [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently if index_exists?(:statuses, ["account_id", "id"], where: "(visibility = 3)")
+ remove_index :statuses, column: [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently if index_exists?(:statuses, ['account_id', 'id'], where: '(visibility = 3)')
end
end
diff --git a/db/migrate/20180617162849_remove_unused_indexes.rb b/db/migrate/20180617162849_remove_unused_indexes.rb
index 61add6385..9cd6b9164 100644
--- a/db/migrate/20180617162849_remove_unused_indexes.rb
+++ b/db/migrate/20180617162849_remove_unused_indexes.rb
@@ -1,7 +1,7 @@
class RemoveUnusedIndexes < ActiveRecord::Migration[5.2]
def change
- remove_index :statuses, name: "index_statuses_on_conversation_id"
- remove_index :users, name: "index_users_on_filtered_languages"
- remove_index :backups, name: "index_backups_on_user_id"
+ remove_index :statuses, name: 'index_statuses_on_conversation_id'
+ remove_index :users, name: 'index_users_on_filtered_languages'
+ remove_index :backups, name: 'index_backups_on_user_id'
end
end
diff --git a/db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb b/db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb
index 24d43a0bf..c5c80b795 100644
--- a/db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb
+++ b/db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb
@@ -6,7 +6,7 @@ class EncryptedMessageIdsToTimestampIds < ActiveRecord::Migration[5.2]
end
def down
- execute("LOCK encrypted_messages")
+ execute('LOCK encrypted_messages')
execute("SELECT setval('encrypted_messages_id_seq', (SELECT MAX(id) FROM encrypted_messages))")
execute("ALTER TABLE encrypted_messages ALTER COLUMN id SET DEFAULT nextval('encrypted_messages_id_seq')")
end
diff --git a/db/migrate/20200622213645_media_attachment_ids_to_timestamp_ids.rb b/db/migrate/20200622213645_media_attachment_ids_to_timestamp_ids.rb
index 5c6865b92..ccd65bf53 100644
--- a/db/migrate/20200622213645_media_attachment_ids_to_timestamp_ids.rb
+++ b/db/migrate/20200622213645_media_attachment_ids_to_timestamp_ids.rb
@@ -10,7 +10,7 @@ class MediaAttachmentIdsToTimestampIds < ActiveRecord::Migration[5.1]
end
def down
- execute("LOCK media_attachments")
+ execute('LOCK media_attachments')
execute("SELECT setval('media_attachments_id_seq', (SELECT MAX(id) FROM media_attachments))")
execute("ALTER TABLE media_attachments ALTER COLUMN id SET DEFAULT nextval('media_attachments_id_seq')")
end
diff --git a/db/migrate/20210306164523_account_ids_to_timestamp_ids.rb b/db/migrate/20210306164523_account_ids_to_timestamp_ids.rb
index 39cd4cdea..40c582842 100644
--- a/db/migrate/20210306164523_account_ids_to_timestamp_ids.rb
+++ b/db/migrate/20210306164523_account_ids_to_timestamp_ids.rb
@@ -10,7 +10,7 @@ class AccountIdsToTimestampIds < ActiveRecord::Migration[5.1]
end
def down
- execute("LOCK accounts")
+ execute('LOCK accounts')
execute("SELECT setval('accounts_id_seq', (SELECT MAX(id) FROM accounts))")
execute("ALTER TABLE accounts ALTER COLUMN id SET DEFAULT nextval('accounts_id_seq')")
end
diff --git a/lib/mastodon/emoji_cli.rb b/lib/mastodon/emoji_cli.rb
index a3e947909..feb77107f 100644
--- a/lib/mastodon/emoji_cli.rb
+++ b/lib/mastodon/emoji_cli.rb
@@ -49,7 +49,7 @@ module Mastodon
next if filename.start_with?('._')
shortcode = [options[:prefix], filename, options[:suffix]].compact.join
- custom_emoji = CustomEmoji.local.find_by("LOWER(shortcode) = ?", shortcode.downcase)
+ custom_emoji = CustomEmoji.local.find_by('LOWER(shortcode) = ?', shortcode.downcase)
if custom_emoji && !options[:overwrite]
skipped += 1
diff --git a/lib/rails/engine_extensions.rb b/lib/rails/engine_extensions.rb
index 4e3767db9..1f5c2cd6c 100644
--- a/lib/rails/engine_extensions.rb
+++ b/lib/rails/engine_extensions.rb
@@ -3,7 +3,7 @@ module Rails
# Rewrite task loading code to filter digitalocean.rake task
def run_tasks_blocks(app)
Railtie.instance_method(:run_tasks_blocks).bind_call(self, app)
- paths["lib/tasks"].existent.reject { |ext| ext.end_with?('digitalocean.rake') }.sort.each { |ext| load(ext) }
+ paths['lib/tasks'].existent.reject { |ext| ext.end_with?('digitalocean.rake') }.sort.each { |ext| load(ext) }
end
end
end
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 477daa01b..179a730bc 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -264,7 +264,7 @@ namespace :mastodon do
env['S3_ENDPOINT'] = prompt.ask('Storj DCS endpoint URL:') do |q|
q.required true
- q.default "https://gateway.storjshare.io"
+ q.default 'https://gateway.storjshare.io'
q.modify :strip
end
diff --git a/spec/controllers/admin/change_email_controller_spec.rb b/spec/controllers/admin/change_email_controller_spec.rb
index cf8a27d39..0814f327d 100644
--- a/spec/controllers/admin/change_email_controller_spec.rb
+++ b/spec/controllers/admin/change_email_controller_spec.rb
@@ -9,8 +9,8 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
sign_in admin
end
- describe "GET #show" do
- it "returns http success" do
+ describe 'GET #show' do
+ it 'returns http success' do
user = Fabricate(:user)
get :show, params: { account_id: user.account.id }
@@ -19,12 +19,12 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
end
end
- describe "GET #update" do
+ describe 'GET #update' do
before do
allow(UserMailer).to receive(:confirmation_instructions).and_return(double('email', deliver_later: nil))
end
- it "returns http success" do
+ it 'returns http success' do
user = Fabricate(:user)
previous_email = user.email
diff --git a/spec/controllers/api/v1/streaming_controller_spec.rb b/spec/controllers/api/v1/streaming_controller_spec.rb
index 4ab409a54..9dbca0178 100644
--- a/spec/controllers/api/v1/streaming_controller_spec.rb
+++ b/spec/controllers/api/v1/streaming_controller_spec.rb
@@ -38,7 +38,7 @@ describe Api::V1::StreamingController do
[:scheme, :path, :query, :fragment].each do |part|
expect(redirect_to_uri.send(part)).to eq(request_uri.send(part)), "redirect target #{part}"
end
- expect(redirect_to_uri.host).to eq(@streaming_host), "redirect target host"
+ expect(redirect_to_uri.host).to eq(@streaming_host), 'redirect target host'
end
end
end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 1b002e01c..f14c451de 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -27,7 +27,7 @@ describe ApplicationController, type: :controller do
expect(response).to have_http_status(code)
end
- it "renders template for http" do
+ it 'renders template for http' do
is_expected.to render_template("errors/#{code}", layout: 'error')
end
end
@@ -146,7 +146,7 @@ describe ApplicationController, type: :controller do
end
it 'does not store location for user if it is devise controller' do
- @request.env["devise.mapping"] = Devise.mappings[:user]
+ @request.env['devise.mapping'] = Devise.mappings[:user]
get 'create'
expect(controller.stored_location_for(:user)).to be_nil
end
diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb
index 38c003b53..7298bde00 100644
--- a/spec/controllers/auth/registrations_controller_spec.rb
+++ b/spec/controllers/auth/registrations_controller_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
describe 'GET #edit' do
it 'returns http success' do
- request.env["devise.mapping"] = Devise.mappings[:user]
+ request.env['devise.mapping'] = Devise.mappings[:user]
sign_in(Fabricate(:user))
get :edit
expect(response).to have_http_status(200)
@@ -41,7 +41,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
describe 'GET #update' do
it 'returns http success' do
- request.env["devise.mapping"] = Devise.mappings[:user]
+ request.env['devise.mapping'] = Devise.mappings[:user]
sign_in(Fabricate(:user), scope: :user)
post :update
expect(response).to have_http_status(200)
@@ -49,7 +49,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
context 'when suspended' do
it 'returns http forbidden' do
- request.env["devise.mapping"] = Devise.mappings[:user]
+ request.env['devise.mapping'] = Devise.mappings[:user]
sign_in(Fabricate(:user, account_attributes: { username: 'test', suspended_at: Time.now.utc }), scope: :user)
post :update
expect(response).to have_http_status(403)
@@ -59,7 +59,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
describe 'GET #new' do
before do
- request.env["devise.mapping"] = Devise.mappings[:user]
+ request.env['devise.mapping'] = Devise.mappings[:user]
end
context do
@@ -92,7 +92,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
I18n.locale = current_locale
end
- before { request.env["devise.mapping"] = Devise.mappings[:user] }
+ before { request.env['devise.mapping'] = Devise.mappings[:user] }
context do
around do |example|
@@ -103,7 +103,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'open'
- request.headers["Accept-Language"] = accept_language
+ request.headers['Accept-Language'] = accept_language
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'true' } }
end
@@ -129,7 +129,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'open'
- request.headers["Accept-Language"] = accept_language
+ request.headers['Accept-Language'] = accept_language
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'false' } }
end
@@ -149,7 +149,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'approved'
- request.headers["Accept-Language"] = accept_language
+ request.headers['Accept-Language'] = accept_language
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', agreement: 'true' } }
end
@@ -176,7 +176,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
subject do
Setting.registrations_mode = 'approved'
- request.headers["Accept-Language"] = accept_language
+ request.headers['Accept-Language'] = accept_language
invite = Fabricate(:invite, max_uses: nil, expires_at: 1.hour.ago)
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
end
@@ -208,7 +208,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
inviter = Fabricate(:user, confirmed_at: 2.days.ago)
Setting.registrations_mode = 'approved'
Setting.require_invite_text = true
- request.headers["Accept-Language"] = accept_language
+ request.headers['Accept-Language'] = accept_language
invite = Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now)
post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } }
end
diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb
index 8f898ad1f..eb03dff50 100644
--- a/spec/controllers/auth/sessions_controller_spec.rb
+++ b/spec/controllers/auth/sessions_controller_spec.rb
@@ -54,7 +54,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
context 'using PAM authentication', if: ENV['PAM_ENABLED'] == 'true' do
context 'using a valid password' do
before do
- post :create, params: { user: { email: "pam_user1", password: '123456' } }
+ post :create, params: { user: { email: 'pam_user1', password: '123456' } }
end
it 'redirects to home' do
@@ -68,7 +68,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
context 'using an invalid password' do
before do
- post :create, params: { user: { email: "pam_user1", password: 'WRONGPW' } }
+ post :create, params: { user: { email: 'pam_user1', password: 'WRONGPW' } }
end
it 'shows a login error' do
@@ -194,7 +194,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
post :create, params: { user: { email: user.email, password: user.password } }
end
- context "in single user mode" do
+ context 'in single user mode' do
let(:single_user_mode) { true }
it 'redirects to home' do
@@ -202,7 +202,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
end
- context "in non-single user mode" do
+ context 'in non-single user mode' do
let(:single_user_mode) { false }
it "redirects back to the user's page" do
@@ -230,8 +230,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders two factor authentication page' do
- expect(controller).to render_template("two_factor")
- expect(controller).to render_template(partial: "_otp_authentication_form")
+ expect(controller).to render_template('two_factor')
+ expect(controller).to render_template(partial: '_otp_authentication_form')
end
end
@@ -246,8 +246,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders two factor authentication page' do
- expect(controller).to render_template("two_factor")
- expect(controller).to render_template(partial: "_otp_authentication_form")
+ expect(controller).to render_template('two_factor')
+ expect(controller).to render_template(partial: '_otp_authentication_form')
end
end
@@ -257,8 +257,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders two factor authentication page' do
- expect(controller).to render_template("two_factor")
- expect(controller).to render_template(partial: "_otp_authentication_form")
+ expect(controller).to render_template('two_factor')
+ expect(controller).to render_template(partial: '_otp_authentication_form')
end
end
@@ -359,8 +359,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders webauthn authentication page' do
- expect(controller).to render_template("two_factor")
- expect(controller).to render_template(partial: "_webauthn_form")
+ expect(controller).to render_template('two_factor')
+ expect(controller).to render_template(partial: '_webauthn_form')
end
end
@@ -370,8 +370,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
it 'renders webauthn authentication page' do
- expect(controller).to render_template("two_factor")
- expect(controller).to render_template(partial: "_webauthn_form")
+ expect(controller).to render_template('two_factor')
+ expect(controller).to render_template(partial: '_webauthn_form')
end
end
diff --git a/spec/controllers/oauth/authorized_applications_controller_spec.rb b/spec/controllers/oauth/authorized_applications_controller_spec.rb
index 901e538e9..885bfa35b 100644
--- a/spec/controllers/oauth/authorized_applications_controller_spec.rb
+++ b/spec/controllers/oauth/authorized_applications_controller_spec.rb
@@ -13,7 +13,7 @@ describe Oauth::AuthorizedApplicationsController do
shared_examples 'stores location for user' do
it 'stores location for user' do
subject
- expect(controller.stored_location_for(:user)).to eq "/oauth/authorized_applications"
+ expect(controller.stored_location_for(:user)).to eq '/oauth/authorized_applications'
end
end
diff --git a/spec/controllers/settings/imports_controller_spec.rb b/spec/controllers/settings/imports_controller_spec.rb
index 8070a35db..e50504cc5 100644
--- a/spec/controllers/settings/imports_controller_spec.rb
+++ b/spec/controllers/settings/imports_controller_spec.rb
@@ -7,8 +7,8 @@ RSpec.describe Settings::ImportsController, type: :controller do
sign_in Fabricate(:user), scope: :user
end
- describe "GET #show" do
- it "returns http success" do
+ describe 'GET #show' do
+ it 'returns http success' do
get :show
expect(response).to have_http_status(200)
end
diff --git a/spec/controllers/settings/profiles_controller_spec.rb b/spec/controllers/settings/profiles_controller_spec.rb
index ee3aec815..fbbca8bb9 100644
--- a/spec/controllers/settings/profiles_controller_spec.rb
+++ b/spec/controllers/settings/profiles_controller_spec.rb
@@ -10,8 +10,8 @@ RSpec.describe Settings::ProfilesController, type: :controller do
sign_in user, scope: :user
end
- describe "GET #show" do
- it "returns http success" do
+ describe 'GET #show' do
+ it 'returns http success' do
get :show
expect(response).to have_http_status(200)
end
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 06989ffd2..c3156c4e9 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
@@ -137,7 +137,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
expect { get :options }.to_not change { user.webauthn_id }
end
- it "includes existing credentials in list of excluded credentials" do
+ it 'includes existing credentials in list of excluded credentials' do
get :options
excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].map { |credential| credential['id'] }
diff --git a/spec/controllers/statuses_cleanup_controller_spec.rb b/spec/controllers/statuses_cleanup_controller_spec.rb
index 924709260..347fe4027 100644
--- a/spec/controllers/statuses_cleanup_controller_spec.rb
+++ b/spec/controllers/statuses_cleanup_controller_spec.rb
@@ -8,8 +8,8 @@ RSpec.describe StatusesCleanupController, type: :controller do
sign_in @user, scope: :user
end
- describe "GET #show" do
- it "returns http success" do
+ describe 'GET #show' do
+ it 'returns http success' do
get :show
expect(response).to have_http_status(200)
end
diff --git a/spec/controllers/well_known/nodeinfo_controller_spec.rb b/spec/controllers/well_known/nodeinfo_controller_spec.rb
index 36e85f20d..964a14706 100644
--- a/spec/controllers/well_known/nodeinfo_controller_spec.rb
+++ b/spec/controllers/well_known/nodeinfo_controller_spec.rb
@@ -27,8 +27,8 @@ describe WellKnown::NodeInfoController, type: :controller do
json = body_as_json
- expect({ "foo" => 0 }).not_to match_json_schema("nodeinfo_2.0")
- expect(json).to match_json_schema("nodeinfo_2.0")
+ expect({ 'foo' => 0 }).not_to 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
expect(json[:software]).to be_a Hash
diff --git a/spec/fabricators/account_moderation_note_fabricator.rb b/spec/fabricators/account_moderation_note_fabricator.rb
index 9277af165..343a41fb1 100644
--- a/spec/fabricators/account_moderation_note_fabricator.rb
+++ b/spec/fabricators/account_moderation_note_fabricator.rb
@@ -1,4 +1,4 @@
Fabricator(:account_moderation_note) do
- content "MyText"
+ content 'MyText'
account nil
end
diff --git a/spec/fabricators/account_note_fabricator.rb b/spec/fabricators/account_note_fabricator.rb
index 1b061745a..285703b38 100644
--- a/spec/fabricators/account_note_fabricator.rb
+++ b/spec/fabricators/account_note_fabricator.rb
@@ -1,5 +1,5 @@
Fabricator(:account_note) do
account
target_account { Fabricate(:account) }
- comment "User note text"
+ comment 'User note text'
end
diff --git a/spec/fabricators/account_stat_fabricator.rb b/spec/fabricators/account_stat_fabricator.rb
index 2b06b4790..b1b47ffef 100644
--- a/spec/fabricators/account_stat_fabricator.rb
+++ b/spec/fabricators/account_stat_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:account_stat) do
account nil
- statuses_count ""
- following_count ""
- followers_count ""
+ statuses_count ''
+ following_count ''
+ followers_count ''
end
diff --git a/spec/fabricators/account_tag_stat_fabricator.rb b/spec/fabricators/account_tag_stat_fabricator.rb
index 9edb550be..7a4de07f6 100644
--- a/spec/fabricators/account_tag_stat_fabricator.rb
+++ b/spec/fabricators/account_tag_stat_fabricator.rb
@@ -1,3 +1,3 @@
Fabricator(:account_tag_stat) do
- accounts_count ""
+ accounts_count ''
end
diff --git a/spec/fabricators/account_warning_preset_fabricator.rb b/spec/fabricators/account_warning_preset_fabricator.rb
index 6c0b87e7c..7e7c03cb8 100644
--- a/spec/fabricators/account_warning_preset_fabricator.rb
+++ b/spec/fabricators/account_warning_preset_fabricator.rb
@@ -1,3 +1,3 @@
Fabricator(:account_warning_preset) do
- text "MyText"
+ text 'MyText'
end
diff --git a/spec/fabricators/admin_action_log_fabricator.rb b/spec/fabricators/admin_action_log_fabricator.rb
index 2f44e953d..474bef1bc 100644
--- a/spec/fabricators/admin_action_log_fabricator.rb
+++ b/spec/fabricators/admin_action_log_fabricator.rb
@@ -1,5 +1,5 @@
Fabricator('Admin::ActionLog') do
account nil
- action "MyString"
+ action 'MyString'
target nil
end
diff --git a/spec/fabricators/canonical_email_block_fabricator.rb b/spec/fabricators/canonical_email_block_fabricator.rb
index a0b6e0d22..61afde3de 100644
--- a/spec/fabricators/canonical_email_block_fabricator.rb
+++ b/spec/fabricators/canonical_email_block_fabricator.rb
@@ -1,4 +1,4 @@
Fabricator(:canonical_email_block) do
- email "test@example.com"
+ email 'test@example.com'
reference_account { Fabricate(:account) }
end
diff --git a/spec/fabricators/conversation_account_fabricator.rb b/spec/fabricators/conversation_account_fabricator.rb
index f57ffd535..0fe7a494e 100644
--- a/spec/fabricators/conversation_account_fabricator.rb
+++ b/spec/fabricators/conversation_account_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:conversation_account) do
account nil
conversation nil
- participant_account_ids ""
+ participant_account_ids ''
last_status nil
end
diff --git a/spec/fabricators/custom_emoji_category_fabricator.rb b/spec/fabricators/custom_emoji_category_fabricator.rb
index f593b95ed..119c343cf 100644
--- a/spec/fabricators/custom_emoji_category_fabricator.rb
+++ b/spec/fabricators/custom_emoji_category_fabricator.rb
@@ -1,3 +1,3 @@
Fabricator(:custom_emoji_category) do
- name "MyString"
+ name 'MyString'
end
diff --git a/spec/fabricators/domain_allow_fabricator.rb b/spec/fabricators/domain_allow_fabricator.rb
index 6226b1e20..6f62ce3b8 100644
--- a/spec/fabricators/domain_allow_fabricator.rb
+++ b/spec/fabricators/domain_allow_fabricator.rb
@@ -1,3 +1,3 @@
Fabricator(:domain_allow) do
- domain "MyString"
+ domain 'MyString'
end
diff --git a/spec/fabricators/encrypted_message_fabricator.rb b/spec/fabricators/encrypted_message_fabricator.rb
index e65f66302..4de0d7add 100644
--- a/spec/fabricators/encrypted_message_fabricator.rb
+++ b/spec/fabricators/encrypted_message_fabricator.rb
@@ -3,6 +3,6 @@ Fabricator(:encrypted_message) do
from_account
from_device_id { Faker::Number.number(digits: 5) }
type 0
- body ""
- message_franking ""
+ body ''
+ message_franking ''
end
diff --git a/spec/fabricators/identity_fabricator.rb b/spec/fabricators/identity_fabricator.rb
index bc832df9f..fcfb15518 100644
--- a/spec/fabricators/identity_fabricator.rb
+++ b/spec/fabricators/identity_fabricator.rb
@@ -1,5 +1,5 @@
Fabricator(:identity) do
user nil
- provider "MyString"
- uid "MyString"
+ provider 'MyString'
+ uid 'MyString'
end
diff --git a/spec/fabricators/ip_block_fabricator.rb b/spec/fabricators/ip_block_fabricator.rb
index 1797f6877..5bd018f9c 100644
--- a/spec/fabricators/ip_block_fabricator.rb
+++ b/spec/fabricators/ip_block_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:ip_block) do
- ip ""
- severity ""
- expires_at "2020-10-08 22:20:37"
- comment "MyText"
+ ip ''
+ severity ''
+ expires_at '2020-10-08 22:20:37'
+ comment 'MyText'
end
diff --git a/spec/fabricators/list_fabricator.rb b/spec/fabricators/list_fabricator.rb
index c3db690fa..4ad29a386 100644
--- a/spec/fabricators/list_fabricator.rb
+++ b/spec/fabricators/list_fabricator.rb
@@ -1,4 +1,4 @@
Fabricator(:list) do
account
- title "MyString"
+ title 'MyString'
end
diff --git a/spec/fabricators/relay_fabricator.rb b/spec/fabricators/relay_fabricator.rb
index 488913f77..d6255866c 100644
--- a/spec/fabricators/relay_fabricator.rb
+++ b/spec/fabricators/relay_fabricator.rb
@@ -1,4 +1,4 @@
Fabricator(:relay) do
- inbox_url "https://example.com/inbox"
+ inbox_url 'https://example.com/inbox'
state :idle
end
diff --git a/spec/fabricators/report_fabricator.rb b/spec/fabricators/report_fabricator.rb
index 2c7101e09..3011c49c6 100644
--- a/spec/fabricators/report_fabricator.rb
+++ b/spec/fabricators/report_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:report) do
account
target_account { Fabricate(:account) }
- comment "You nasty"
+ comment 'You nasty'
action_taken_at nil
end
diff --git a/spec/fabricators/report_note_fabricator.rb b/spec/fabricators/report_note_fabricator.rb
index e139efffb..33f384074 100644
--- a/spec/fabricators/report_note_fabricator.rb
+++ b/spec/fabricators/report_note_fabricator.rb
@@ -1,5 +1,5 @@
Fabricator(:report_note) do
report
account { Fabricate(:account) }
- content "Test Content"
+ content 'Test Content'
end
diff --git a/spec/fabricators/session_activation_fabricator.rb b/spec/fabricators/session_activation_fabricator.rb
index 526faaec2..a7fc3b017 100644
--- a/spec/fabricators/session_activation_fabricator.rb
+++ b/spec/fabricators/session_activation_fabricator.rb
@@ -1,4 +1,4 @@
Fabricator(:session_activation) do
user
- session_id "MyString"
+ session_id 'MyString'
end
diff --git a/spec/fabricators/status_edit_fabricator.rb b/spec/fabricators/status_edit_fabricator.rb
index 3141759e5..0e5796b23 100644
--- a/spec/fabricators/status_edit_fabricator.rb
+++ b/spec/fabricators/status_edit_fabricator.rb
@@ -1,7 +1,7 @@
Fabricator(:status_edit) do
status nil
account nil
- text "MyText"
- spoiler_text "MyText"
+ text 'MyText'
+ spoiler_text 'MyText'
media_attachments_changed false
end
diff --git a/spec/fabricators/status_fabricator.rb b/spec/fabricators/status_fabricator.rb
index 04bbbcf4b..8a0a8aa55 100644
--- a/spec/fabricators/status_fabricator.rb
+++ b/spec/fabricators/status_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:status) do
account
- text "Lorem ipsum dolor sit amet"
+ text 'Lorem ipsum dolor sit amet'
after_build do |status|
status.uri = Faker::Internet.device_token if !status.account.local? && status.uri.nil?
diff --git a/spec/fabricators/status_stat_fabricator.rb b/spec/fabricators/status_stat_fabricator.rb
index 9c67fd404..feba9fbca 100644
--- a/spec/fabricators/status_stat_fabricator.rb
+++ b/spec/fabricators/status_stat_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:status_stat) do
status_id nil
- replies_count ""
- reblogs_count ""
- favourites_count ""
+ replies_count ''
+ reblogs_count ''
+ favourites_count ''
end
diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb
index 10ad2c53a..93ce07a74 100644
--- a/spec/fabricators/user_fabricator.rb
+++ b/spec/fabricators/user_fabricator.rb
@@ -1,7 +1,7 @@
Fabricator(:user) do
account { Fabricate.build(:account, user: nil) }
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
- password "123456789"
+ password '123456789'
confirmed_at { Time.zone.now }
agreement true
end
diff --git a/spec/fabricators/user_role_fabricator.rb b/spec/fabricators/user_role_fabricator.rb
index ed0a7dc1f..592b4edca 100644
--- a/spec/fabricators/user_role_fabricator.rb
+++ b/spec/fabricators/user_role_fabricator.rb
@@ -1,5 +1,5 @@
Fabricator(:user_role) do
- name "MyString"
- color ""
+ name 'MyString'
+ color ''
permissions 0
end
diff --git a/spec/features/log_in_spec.rb b/spec/features/log_in_spec.rb
index 329cdf34c..5ae738ee2 100644
--- a/spec/features/log_in_spec.rb
+++ b/spec/features/log_in_spec.rb
@@ -7,8 +7,8 @@ describe 'Log in' do
subject { page }
- let(:email) { "test@example.com" }
- let(:password) { "password" }
+ let(:email) { 'test@example.com' }
+ let(:password) { 'password' }
let(:confirmed_at) { Time.zone.now }
before do
diff --git a/spec/helpers/accounts_helper_spec.rb b/spec/helpers/accounts_helper_spec.rb
index 2b35b23b7..1f412a39f 100644
--- a/spec/helpers/accounts_helper_spec.rb
+++ b/spec/helpers/accounts_helper_spec.rb
@@ -13,15 +13,15 @@ RSpec.describe AccountsHelper, type: :helper do
describe '#display_name' do
it 'uses the display name when it exists' do
- account = Account.new(display_name: "Display", username: "Username")
+ account = Account.new(display_name: 'Display', username: 'Username')
- expect(helper.display_name(account)).to eq "Display"
+ expect(helper.display_name(account)).to eq 'Display'
end
it 'uses the username when display name is nil' do
- account = Account.new(display_name: nil, username: "Username")
+ account = Account.new(display_name: nil, username: 'Username')
- expect(helper.display_name(account)).to eq "Username"
+ expect(helper.display_name(account)).to eq 'Username'
end
end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 1dbd985bf..b335a5e45 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -5,8 +5,8 @@ describe ApplicationHelper do
it 'returns active when on the current page' do
allow(helper).to receive(:current_page?).and_return(true)
- result = helper.active_nav_class("/test")
- expect(result).to eq "active"
+ result = helper.active_nav_class('/test')
+ expect(result).to eq 'active'
end
it 'returns active when on a current page' do
@@ -14,14 +14,14 @@ describe ApplicationHelper do
allow(helper).to receive(:current_page?).with('/test').and_return(true)
result = helper.active_nav_class('/foo', '/test')
- expect(result).to eq "active"
+ expect(result).to eq 'active'
end
it 'returns empty string when not on current page' do
allow(helper).to receive(:current_page?).and_return(false)
- result = helper.active_nav_class("/test")
- expect(result).to eq ""
+ result = helper.active_nav_class('/test')
+ expect(result).to eq ''
end
end
diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb
index eb55c3983..7195cec06 100644
--- a/spec/lib/feed_manager_spec.rb
+++ b/spec/lib/feed_manager_spec.rb
@@ -416,7 +416,7 @@ RSpec.describe FeedManager do
FeedManager.instance.merge_into_home(account, reblog.account)
- expect(redis.zscore("feed:home:0", reblog.id)).to eq nil
+ expect(redis.zscore('feed:home:0', reblog.id)).to eq nil
end
end
diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb
index 29bdc349b..6746871a3 100644
--- a/spec/mailers/notification_mailer_spec.rb
+++ b/spec/mailers/notification_mailer_spec.rb
@@ -1,4 +1,4 @@
-require "rails_helper"
+require 'rails_helper'
RSpec.describe NotificationMailer, type: :mailer do
let(:receiver) { Fabricate(:user) }
@@ -19,69 +19,69 @@ RSpec.describe NotificationMailer, type: :mailer do
end
end
- describe "mention" do
+ describe 'mention' do
let(:mention) { Mention.create!(account: receiver.account, status: foreign_status) }
let(:mail) { NotificationMailer.mention(receiver.account, Notification.create!(account: receiver.account, activity: mention)) }
include_examples 'localized subject', 'notification_mailer.mention.subject', name: 'bob'
- it "renders the headers" do
- expect(mail.subject).to eq("You were mentioned by bob")
+ it 'renders the headers' do
+ expect(mail.subject).to eq('You were mentioned by bob')
expect(mail.to).to eq([receiver.email])
end
- it "renders the body" do
- expect(mail.body.encoded).to match("You were mentioned by bob")
+ it 'renders the body' do
+ expect(mail.body.encoded).to match('You were mentioned by bob')
expect(mail.body.encoded).to include 'The body of the foreign status'
end
end
- describe "follow" do
+ describe 'follow' do
let(:follow) { sender.follow!(receiver.account) }
let(:mail) { NotificationMailer.follow(receiver.account, Notification.create!(account: receiver.account, activity: follow)) }
include_examples 'localized subject', 'notification_mailer.follow.subject', name: 'bob'
- it "renders the headers" do
- expect(mail.subject).to eq("bob is now following you")
+ it 'renders the headers' do
+ expect(mail.subject).to eq('bob is now following you')
expect(mail.to).to eq([receiver.email])
end
- it "renders the body" do
- expect(mail.body.encoded).to match("bob is now following you")
+ it 'renders the body' do
+ expect(mail.body.encoded).to match('bob is now following you')
end
end
- describe "favourite" do
+ describe 'favourite' do
let(:favourite) { Favourite.create!(account: sender, status: own_status) }
let(:mail) { NotificationMailer.favourite(own_status.account, Notification.create!(account: receiver.account, activity: favourite)) }
include_examples 'localized subject', 'notification_mailer.favourite.subject', name: 'bob'
- it "renders the headers" do
- expect(mail.subject).to eq("bob favourited your post")
+ it 'renders the headers' do
+ expect(mail.subject).to eq('bob favourited your post')
expect(mail.to).to eq([receiver.email])
end
- it "renders the body" do
- expect(mail.body.encoded).to match("Your post was favourited by bob")
+ it 'renders the body' do
+ expect(mail.body.encoded).to match('Your post was favourited by bob')
expect(mail.body.encoded).to include 'The body of the own status'
end
end
- describe "reblog" do
+ describe 'reblog' do
let(:reblog) { Status.create!(account: sender, reblog: own_status) }
let(:mail) { NotificationMailer.reblog(own_status.account, Notification.create!(account: receiver.account, activity: reblog)) }
include_examples 'localized subject', 'notification_mailer.reblog.subject', name: 'bob'
- it "renders the headers" do
- expect(mail.subject).to eq("bob boosted your post")
+ it 'renders the headers' do
+ expect(mail.subject).to eq('bob boosted your post')
expect(mail.to).to eq([receiver.email])
end
- it "renders the body" do
- expect(mail.body.encoded).to match("Your post was boosted by bob")
+ it 'renders the body' do
+ expect(mail.body.encoded).to match('Your post was boosted by bob')
expect(mail.body.encoded).to include 'The body of the own status'
end
end
@@ -98,7 +98,7 @@ RSpec.describe NotificationMailer, type: :mailer do
end
it 'renders the body' do
- expect(mail.body.encoded).to match("bob has requested to follow you")
+ expect(mail.body.encoded).to match('bob has requested to follow you')
end
end
end
diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb
index 2ed33c1e4..9c22f60f1 100644
--- a/spec/mailers/user_mailer_spec.rb
+++ b/spec/mailers/user_mailer_spec.rb
@@ -90,7 +90,7 @@ describe UserMailer, type: :mailer do
it 'renders warning notification' do
receiver.update!(locale: nil)
- expect(mail.body.encoded).to include I18n.t("user_mailer.warning.title.suspend", acct: receiver.account.acct)
+ expect(mail.body.encoded).to include I18n.t('user_mailer.warning.title.suspend', acct: receiver.account.acct)
expect(mail.body.encoded).to include strike.text
end
end
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 694432a1e..763835618 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -345,9 +345,9 @@ RSpec.describe Account, type: :model do
before do
_missing = Fabricate(
:account,
- display_name: "Missing",
- username: "missing",
- domain: "missing.com"
+ display_name: 'Missing',
+ username: 'missing',
+ domain: 'missing.com'
)
end
@@ -405,58 +405,58 @@ RSpec.describe Account, type: :model do
it 'finds accounts with matching display_name' do
match = Fabricate(
:account,
- display_name: "Display Name",
- username: "username",
- domain: "example.com"
+ display_name: 'Display Name',
+ username: 'username',
+ domain: 'example.com'
)
- results = Account.search_for("display")
+ results = Account.search_for('display')
expect(results).to eq [match]
end
it 'finds accounts with matching username' do
match = Fabricate(
:account,
- display_name: "Display Name",
- username: "username",
- domain: "example.com"
+ display_name: 'Display Name',
+ username: 'username',
+ domain: 'example.com'
)
- results = Account.search_for("username")
+ results = Account.search_for('username')
expect(results).to eq [match]
end
it 'finds accounts with matching domain' do
match = Fabricate(
:account,
- display_name: "Display Name",
- username: "username",
- domain: "example.com"
+ display_name: 'Display Name',
+ username: 'username',
+ domain: 'example.com'
)
- results = Account.search_for("example")
+ results = Account.search_for('example')
expect(results).to eq [match]
end
it 'limits by 10 by default' do
- 11.times.each { Fabricate(:account, display_name: "Display Name") }
- results = Account.search_for("display")
+ 11.times.each { Fabricate(:account, display_name: 'Display Name') }
+ results = Account.search_for('display')
expect(results.size).to eq 10
end
it 'accepts arbitrary limits' do
- 2.times.each { Fabricate(:account, display_name: "Display Name") }
- results = Account.search_for("display", limit: 1)
+ 2.times.each { Fabricate(:account, display_name: 'Display Name') }
+ results = Account.search_for('display', limit: 1)
expect(results.size).to eq 1
end
it 'ranks multiple matches higher' do
matches = [
- { username: "username", display_name: "username" },
- { display_name: "Display Name", username: "username", domain: "example.com" },
+ { username: 'username', display_name: 'username' },
+ { display_name: 'Display Name', username: 'username', domain: 'example.com' },
].map(&method(:Fabricate).curry(2).call(:account))
- results = Account.search_for("username")
+ results = Account.search_for('username')
expect(results).to eq matches
end
end
@@ -582,23 +582,23 @@ RSpec.describe Account, type: :model do
end
it 'limits by 10 by default' do
- 11.times { Fabricate(:account, display_name: "Display Name") }
- results = Account.advanced_search_for("display", account)
+ 11.times { Fabricate(:account, display_name: 'Display Name') }
+ results = Account.advanced_search_for('display', account)
expect(results.size).to eq 10
end
it 'accepts arbitrary limits' do
- 2.times { Fabricate(:account, display_name: "Display Name") }
- results = Account.advanced_search_for("display", account, limit: 1)
+ 2.times { Fabricate(:account, display_name: 'Display Name') }
+ results = Account.advanced_search_for('display', account, limit: 1)
expect(results.size).to eq 1
end
it 'ranks followed accounts higher' do
- match = Fabricate(:account, username: "Matching")
- followed_match = Fabricate(:account, username: "Matcher")
+ match = Fabricate(:account, username: 'Matching')
+ followed_match = Fabricate(:account, username: 'Matcher')
Fabricate(:follow, account: account, target_account: followed_match)
- results = Account.advanced_search_for("match", account)
+ results = Account.advanced_search_for('match', account)
expect(results).to eq [followed_match, match]
expect(results.first.rank).to be > results.last.rank
end
diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb
index 29fd313ae..d1a94d41a 100644
--- a/spec/models/media_attachment_spec.rb
+++ b/spec/models/media_attachment_spec.rb
@@ -94,8 +94,8 @@ RSpec.describe MediaAttachment, type: :model do
end
it 'sets meta' do
- expect(media.file.meta["original"]["width"]).to eq 128
- expect(media.file.meta["original"]["height"]).to eq 128
+ expect(media.file.meta['original']['width']).to eq 128
+ expect(media.file.meta['original']['height']).to eq 128
end
end
@@ -118,9 +118,9 @@ RSpec.describe MediaAttachment, type: :model do
end
it 'sets meta' do
- expect(media.file.meta["original"]["width"]).to eq fixture[:width]
- expect(media.file.meta["original"]["height"]).to eq fixture[:height]
- expect(media.file.meta["original"]["aspect"]).to eq fixture[:aspect]
+ expect(media.file.meta['original']['width']).to eq fixture[:width]
+ expect(media.file.meta['original']['height']).to eq fixture[:height]
+ expect(media.file.meta['original']['aspect']).to eq fixture[:aspect]
end
end
end
@@ -154,12 +154,12 @@ RSpec.describe MediaAttachment, type: :model do
let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.jpg')) }
it 'sets meta for different style' do
- expect(media.file.meta["original"]["width"]).to eq 600
- expect(media.file.meta["original"]["height"]).to eq 400
- expect(media.file.meta["original"]["aspect"]).to eq 1.5
- expect(media.file.meta["small"]["width"]).to eq 588
- expect(media.file.meta["small"]["height"]).to eq 392
- expect(media.file.meta["small"]["aspect"]).to eq 1.5
+ expect(media.file.meta['original']['width']).to eq 600
+ expect(media.file.meta['original']['height']).to eq 400
+ expect(media.file.meta['original']['aspect']).to eq 1.5
+ expect(media.file.meta['small']['width']).to eq 588
+ expect(media.file.meta['small']['height']).to eq 392
+ expect(media.file.meta['small']['aspect']).to eq 1.5
end
it 'gives the file a random name' do
diff --git a/spec/models/web/push_subscription_spec.rb b/spec/models/web/push_subscription_spec.rb
index bd5719593..eeadbb71c 100644
--- a/spec/models/web/push_subscription_spec.rb
+++ b/spec/models/web/push_subscription_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe Web::PushSubscription, type: :model do
context "when notification is a #{type}" do
let(:notification_type) { type }
- it "returns boolean corresponding to alert setting" do
+ it 'returns boolean corresponding to alert setting' do
expect(subject.pushable?(notification)).to eq data[:alerts][type]
end
end
diff --git a/spec/models/webauthn_credentials_spec.rb b/spec/models/webauthn_credentials_spec.rb
index a63ae6cd2..e070a6b60 100644
--- a/spec/models/webauthn_credentials_spec.rb
+++ b/spec/models/webauthn_credentials_spec.rb
@@ -35,8 +35,8 @@ RSpec.describe WebauthnCredential, type: :model do
end
it 'is invalid if already exist a webauthn credential with the same external id' do
- existing_webauthn_credential = Fabricate(:webauthn_credential, external_id: "_Typ0ygudDnk9YUVWLQayw")
- new_webauthn_credential = Fabricate.build(:webauthn_credential, external_id: "_Typ0ygudDnk9YUVWLQayw")
+ existing_webauthn_credential = Fabricate(:webauthn_credential, external_id: '_Typ0ygudDnk9YUVWLQayw')
+ new_webauthn_credential = Fabricate.build(:webauthn_credential, external_id: '_Typ0ygudDnk9YUVWLQayw')
new_webauthn_credential.valid?
diff --git a/spec/presenters/instance_presenter_spec.rb b/spec/presenters/instance_presenter_spec.rb
index 659c2cc2f..a451b5cba 100644
--- a/spec/presenters/instance_presenter_spec.rb
+++ b/spec/presenters/instance_presenter_spec.rb
@@ -10,9 +10,9 @@ describe InstancePresenter do
Setting.site_short_description = site_description
end
- it "delegates site_description to Setting" do
- Setting.site_short_description = "Site desc"
- expect(instance_presenter.description).to eq "Site desc"
+ it 'delegates site_description to Setting' do
+ Setting.site_short_description = 'Site desc'
+ expect(instance_presenter.description).to eq 'Site desc'
end
end
@@ -23,9 +23,9 @@ describe InstancePresenter do
Setting.site_extended_description = site_extended_description
end
- it "delegates site_extended_description to Setting" do
- Setting.site_extended_description = "Extended desc"
- expect(instance_presenter.extended_description).to eq "Extended desc"
+ it 'delegates site_extended_description to Setting' do
+ Setting.site_extended_description = 'Extended desc'
+ expect(instance_presenter.extended_description).to eq 'Extended desc'
end
end
@@ -36,9 +36,9 @@ describe InstancePresenter do
Setting.site_contact_email = site_contact_email
end
- it "delegates contact_email to Setting" do
- Setting.site_contact_email = "admin@example.com"
- expect(instance_presenter.contact.email).to eq "admin@example.com"
+ it 'delegates contact_email to Setting' do
+ Setting.site_contact_email = 'admin@example.com'
+ expect(instance_presenter.contact.email).to eq 'admin@example.com'
end
end
@@ -49,15 +49,15 @@ describe InstancePresenter do
Setting.site_contact_username = site_contact_username
end
- it "returns the account for the site contact username" do
- Setting.site_contact_username = "aaa"
- account = Fabricate(:account, username: "aaa")
+ it 'returns the account for the site contact username' do
+ Setting.site_contact_username = 'aaa'
+ account = Fabricate(:account, username: 'aaa')
expect(instance_presenter.contact.account).to eq(account)
end
end
describe '#user_count' do
- it "returns the number of site users" do
+ it 'returns the number of site users' do
Rails.cache.write 'user_count', 123
expect(instance_presenter.user_count).to eq(123)
@@ -65,7 +65,7 @@ describe InstancePresenter do
end
describe '#status_count' do
- it "returns the number of local statuses" do
+ it 'returns the number of local statuses' do
Rails.cache.write 'local_status_count', 234
expect(instance_presenter.status_count).to eq(234)
@@ -73,7 +73,7 @@ describe InstancePresenter do
end
describe '#domain_count' do
- it "returns the number of known domains" do
+ it 'returns the number of known domains' do
Rails.cache.write 'distinct_domain_count', 345
expect(instance_presenter.domain_count).to eq(345)
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 20e48b9a3..9a14fc3b1 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -1,7 +1,7 @@
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
-abort("The Rails environment is running in production mode!") if Rails.env.production?
+abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
diff --git a/spec/requests/catch_all_route_request_spec.rb b/spec/requests/catch_all_route_request_spec.rb
index f965f5522..fb18965d8 100644
--- a/spec/requests/catch_all_route_request_spec.rb
+++ b/spec/requests/catch_all_route_request_spec.rb
@@ -1,21 +1,21 @@
-require "rails_helper"
+require 'rails_helper'
-describe "The catch all route" do
- describe "with a simple value" do
- it "returns a 404 page as html" do
- get "/test"
+describe 'The catch all route' do
+ describe 'with a simple value' do
+ it 'returns a 404 page as html' do
+ get '/test'
expect(response.status).to eq 404
- expect(response.media_type).to eq "text/html"
+ expect(response.media_type).to eq 'text/html'
end
end
- describe "with an implied format" do
- it "returns a 404 page as html" do
- get "/test.test"
+ describe 'with an implied format' do
+ it 'returns a 404 page as html' do
+ get '/test.test'
expect(response.status).to eq 404
- expect(response.media_type).to eq "text/html"
+ expect(response.media_type).to eq 'text/html'
end
end
end
diff --git a/spec/requests/host_meta_request_spec.rb b/spec/requests/host_meta_request_spec.rb
index 0ca641461..60153ba8c 100644
--- a/spec/requests/host_meta_request_spec.rb
+++ b/spec/requests/host_meta_request_spec.rb
@@ -1,12 +1,12 @@
-require "rails_helper"
+require 'rails_helper'
-describe "The host_meta route" do
- describe "requested without accepts headers" do
- it "returns an xml response" do
+describe 'The host_meta route' do
+ describe 'requested without accepts headers' do
+ it 'returns an xml response' do
get host_meta_url
expect(response).to have_http_status(200)
- expect(response.media_type).to eq "application/xrd+xml"
+ expect(response.media_type).to eq 'application/xrd+xml'
end
end
end
diff --git a/spec/requests/localization_spec.rb b/spec/requests/localization_spec.rb
index 0bc2786ac..39eeee5f0 100644
--- a/spec/requests/localization_spec.rb
+++ b/spec/requests/localization_spec.rb
@@ -10,7 +10,7 @@ describe 'Localization' do
it 'uses a specific region when provided' do
headers = { 'Accept-Language' => 'zh-HK' }
- get "/auth/sign_in", headers: headers
+ get '/auth/sign_in', headers: headers
expect(response.body).to include(
I18n.t('auth.login', locale: 'zh-HK')
@@ -20,7 +20,7 @@ describe 'Localization' do
it 'falls back to a locale when region missing' do
headers = { 'Accept-Language' => 'es-FAKE' }
- get "/auth/sign_in", headers: headers
+ get '/auth/sign_in', headers: headers
expect(response.body).to include(
I18n.t('auth.login', locale: 'es')
@@ -30,7 +30,7 @@ describe 'Localization' do
it 'falls back to english when locale is missing' do
headers = { 'Accept-Language' => '12-FAKE' }
- get "/auth/sign_in", headers: headers
+ get '/auth/sign_in', headers: headers
expect(response.body).to include(
I18n.t('auth.login', locale: 'en')
diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb
index 81cbc175e..d3b5baad6 100644
--- a/spec/services/account_search_service_spec.rb
+++ b/spec/services/account_search_service_spec.rb
@@ -76,7 +76,7 @@ describe AccountSearchService, type: :service do
expect(results).to eq [partial]
end
- it "does not return suspended remote accounts" do
+ it 'does not return suspended remote accounts' do
remote = Fabricate(:account, username: 'a', domain: 'remote', display_name: 'e', suspended: true)
results = subject.call('a@example.com', nil, limit: 2)
diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb
index e02054672..4f3503ac2 100644
--- a/spec/services/activitypub/fetch_remote_status_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:note) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1234",
+ id: 'https://foo.bar/@foo/1234',
type: 'Note',
content: 'Lorem ipsum',
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
@@ -46,7 +46,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1234",
+ id: 'https://foo.bar/@foo/1234',
type: 'Video',
name: 'Nyan Cat 10 hours remix',
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
@@ -54,13 +54,13 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
{
type: 'Link',
mimeType: 'application/x-bittorrent',
- href: "https://foo.bar/12345.torrent",
+ href: 'https://foo.bar/12345.torrent',
},
{
type: 'Link',
mimeType: 'text/html',
- href: "https://foo.bar/watch?v=12345",
+ href: 'https://foo.bar/watch?v=12345',
},
],
}
@@ -70,8 +70,8 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
status = sender.statuses.first
expect(status).to_not be_nil
- expect(status.url).to eq "https://foo.bar/watch?v=12345"
- expect(strip_tags(status.text)).to eq "Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345"
+ expect(status.url).to eq 'https://foo.bar/watch?v=12345'
+ expect(strip_tags(status.text)).to eq 'Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345'
end
end
@@ -79,7 +79,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1234",
+ id: 'https://foo.bar/@foo/1234',
type: 'Audio',
name: 'Nyan Cat 10 hours remix',
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
@@ -87,13 +87,13 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
{
type: 'Link',
mimeType: 'application/x-bittorrent',
- href: "https://foo.bar/12345.torrent",
+ href: 'https://foo.bar/12345.torrent',
},
{
type: 'Link',
mimeType: 'text/html',
- href: "https://foo.bar/watch?v=12345",
+ href: 'https://foo.bar/watch?v=12345',
},
],
}
@@ -103,8 +103,8 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
status = sender.statuses.first
expect(status).to_not be_nil
- expect(status.url).to eq "https://foo.bar/watch?v=12345"
- expect(strip_tags(status.text)).to eq "Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345"
+ expect(status.url).to eq 'https://foo.bar/watch?v=12345'
+ expect(strip_tags(status.text)).to eq 'Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345'
end
end
@@ -112,7 +112,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1234",
+ id: 'https://foo.bar/@foo/1234',
type: 'Event',
name: "Let's change the world",
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
@@ -123,7 +123,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
status = sender.statuses.first
expect(status).to_not be_nil
- expect(status.url).to eq "https://foo.bar/@foo/1234"
+ expect(status.url).to eq 'https://foo.bar/@foo/1234'
expect(strip_tags(status.text)).to eq "Let's change the worldhttps://foo.bar/@foo/1234"
end
end
@@ -132,7 +132,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:note) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://real.address/@foo/1234",
+ id: 'https://real.address/@foo/1234',
type: 'Note',
content: 'Lorem ipsum',
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
@@ -154,7 +154,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1234/create",
+ id: 'https://foo.bar/@foo/1234/create',
type: 'Create',
actor: ActivityPub::TagManager.instance.uri_for(sender),
object: note,
@@ -174,11 +174,11 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1234/create",
+ id: 'https://foo.bar/@foo/1234/create',
type: 'Create',
actor: ActivityPub::TagManager.instance.uri_for(sender),
object: {
- id: "https://real.address/@foo/1234",
+ id: 'https://real.address/@foo/1234',
type: 'Note',
content: 'Lorem ipsum',
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
@@ -208,7 +208,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1234/create",
+ id: 'https://foo.bar/@foo/1234/create',
type: 'Create',
actor: ActivityPub::TagManager.instance.uri_for(sender),
object: note.merge(updated: '2021-09-08T22:39:25Z'),
@@ -233,7 +233,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1",
+ id: 'https://foo.bar/@foo/1',
type: 'Note',
content: 'Lorem ipsum',
inReplyTo: 'https://foo.bar/@foo/2',
@@ -269,7 +269,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
let(:object) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://foo.bar/@foo/1",
+ id: 'https://foo.bar/@foo/1',
type: 'Note',
content: 'Lorem ipsum',
replies: {
diff --git a/spec/services/delete_account_service_spec.rb b/spec/services/delete_account_service_spec.rb
index 1fbe4d07c..cc4b168fc 100644
--- a/spec/services/delete_account_service_spec.rb
+++ b/spec/services/delete_account_service_spec.rb
@@ -59,8 +59,8 @@ RSpec.describe DeleteAccountService, type: :service do
describe '#call on local account' do
before do
- stub_request(:post, "https://alice.com/inbox").to_return(status: 201)
- stub_request(:post, "https://bob.com/inbox").to_return(status: 201)
+ stub_request(:post, 'https://alice.com/inbox').to_return(status: 201)
+ stub_request(:post, 'https://bob.com/inbox').to_return(status: 201)
end
let!(:remote_alice) { Fabricate(:account, inbox_url: 'https://alice.com/inbox', protocol: :activitypub) }
@@ -72,16 +72,16 @@ RSpec.describe DeleteAccountService, type: :service do
it 'sends a delete actor activity to all known inboxes' do
subject
- expect(a_request(:post, "https://alice.com/inbox")).to have_been_made.once
- expect(a_request(:post, "https://bob.com/inbox")).to have_been_made.once
+ expect(a_request(:post, 'https://alice.com/inbox')).to have_been_made.once
+ expect(a_request(:post, 'https://bob.com/inbox')).to have_been_made.once
end
end
end
describe '#call on remote account' do
before do
- stub_request(:post, "https://alice.com/inbox").to_return(status: 201)
- stub_request(:post, "https://bob.com/inbox").to_return(status: 201)
+ stub_request(:post, 'https://alice.com/inbox').to_return(status: 201)
+ stub_request(:post, 'https://bob.com/inbox').to_return(status: 201)
end
include_examples 'common behavior' do
diff --git a/spec/services/favourite_service_spec.rb b/spec/services/favourite_service_spec.rb
index 9781f0d78..8703c2af8 100644
--- a/spec/services/favourite_service_spec.rb
+++ b/spec/services/favourite_service_spec.rb
@@ -23,7 +23,7 @@ RSpec.describe FavouriteService, type: :service do
let(:status) { Fabricate(:status, account: bob) }
before do
- stub_request(:post, "http://example.com/inbox").to_return(status: 200, body: "", headers: {})
+ stub_request(:post, 'http://example.com/inbox').to_return(status: 200, body: '', headers: {})
subject.call(sender, status)
end
@@ -32,7 +32,7 @@ RSpec.describe FavouriteService, type: :service do
end
it 'sends a like activity' do
- expect(a_request(:post, "http://example.com/inbox")).to have_been_made.once
+ expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
end
end
end
diff --git a/spec/services/fetch_link_card_service_spec.rb b/spec/services/fetch_link_card_service_spec.rb
index 4914c2753..458473c39 100644
--- a/spec/services/fetch_link_card_service_spec.rb
+++ b/spec/services/fetch_link_card_service_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe FetchLinkCardService, type: :service do
it 'works with SJIS' do
expect(a_request(:get, 'http://example.com/sjis')).to have_been_made.at_least_once
- expect(status.preview_cards.first.title).to eq("SJISのページ")
+ expect(status.preview_cards.first.title).to eq('SJISのページ')
end
end
@@ -39,7 +39,7 @@ RSpec.describe FetchLinkCardService, type: :service do
it 'works with SJIS even with wrong charset header' do
expect(a_request(:get, 'http://example.com/sjis_with_wrong_charset')).to have_been_made.at_least_once
- expect(status.preview_cards.first.title).to eq("SJISのページ")
+ expect(status.preview_cards.first.title).to eq('SJISのページ')
end
end
@@ -48,7 +48,7 @@ RSpec.describe FetchLinkCardService, type: :service do
it 'works with koi8-r' do
expect(a_request(:get, 'http://example.com/koi8-r')).to have_been_made.at_least_once
- expect(status.preview_cards.first.title).to eq("Московя начинаетъ только въ XVI ст. привлекать внимане иностранцевъ.")
+ expect(status.preview_cards.first.title).to eq('Московя начинаетъ только въ XVI ст. привлекать внимане иностранцевъ.')
end
end
@@ -66,7 +66,7 @@ RSpec.describe FetchLinkCardService, type: :service do
it 'works with Japanese path string' do
expect(a_request(:get, 'http://example.com/日本語')).to have_been_made.at_least_once
- expect(status.preview_cards.first.title).to eq("SJISのページ")
+ expect(status.preview_cards.first.title).to eq('SJISのページ')
end
end
diff --git a/spec/services/fetch_oembed_service_spec.rb b/spec/services/fetch_oembed_service_spec.rb
index dcd0f80de..cf46f2d39 100644
--- a/spec/services/fetch_oembed_service_spec.rb
+++ b/spec/services/fetch_oembed_service_spec.rb
@@ -6,9 +6,9 @@ describe FetchOEmbedService, type: :service do
subject { described_class.new }
before do
- stub_request(:get, "https://host.test/provider.json").to_return(status: 404)
- stub_request(:get, "https://host.test/provider.xml").to_return(status: 404)
- stub_request(:get, "https://host.test/empty_provider.json").to_return(status: 200)
+ stub_request(:get, 'https://host.test/provider.json').to_return(status: 404)
+ stub_request(:get, 'https://host.test/provider.xml').to_return(status: 404)
+ stub_request(:get, 'https://host.test/empty_provider.json').to_return(status: 200)
end
describe 'discover_provider' do
diff --git a/spec/services/fetch_remote_status_service_spec.rb b/spec/services/fetch_remote_status_service_spec.rb
index 4f6ad6496..02c62f8d6 100644
--- a/spec/services/fetch_remote_status_service_spec.rb
+++ b/spec/services/fetch_remote_status_service_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe FetchRemoteStatusService, type: :service do
let(:note) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
- id: "https://example.org/@foo/1234",
+ id: 'https://example.org/@foo/1234',
type: 'Note',
content: 'Lorem ipsum',
attributedTo: ActivityPub::TagManager.instance.uri_for(account),
diff --git a/spec/services/follow_service_spec.rb b/spec/services/follow_service_spec.rb
index 412c04d76..59073c27f 100644
--- a/spec/services/follow_service_spec.rb
+++ b/spec/services/follow_service_spec.rb
@@ -140,7 +140,7 @@ RSpec.describe FollowService, type: :service do
let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }
before do
- stub_request(:post, "http://example.com/inbox").to_return(status: 200, body: "", headers: {})
+ stub_request(:post, 'http://example.com/inbox').to_return(status: 200, body: '', headers: {})
subject.call(sender, bob)
end
diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb
index 399a43036..a12148833 100644
--- a/spec/services/import_service_spec.rb
+++ b/spec/services/import_service_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe ImportService, type: :service do
let!(:eve) { Fabricate(:account, username: 'eve', domain: 'example.com', locked: false, protocol: :activitypub, inbox_url: 'https://example.com/inbox') }
before do
- stub_request(:post, "https://example.com/inbox").to_return(status: 200)
+ stub_request(:post, 'https://example.com/inbox').to_return(status: 200)
end
context 'import old-style list of muted users' do
@@ -186,7 +186,7 @@ RSpec.describe ImportService, type: :service do
# Make sure to not actually go to the remote server
before do
- stub_request(:post, "https://թութ.հայ/inbox").to_return(status: 200)
+ stub_request(:post, 'https://թութ.հայ/inbox').to_return(status: 200)
end
let(:csv) { attachment_fixture('utf8-followers.txt') }
diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb
index 7bb7dfb1f..0b72253a5 100644
--- a/spec/services/post_status_service_spec.rb
+++ b/spec/services/post_status_service_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe PostStatusService, type: :service do
it 'creates a new status' do
account = Fabricate(:account)
- text = "test status update"
+ text = 'test status update'
status = subject.call(account, text: text)
@@ -16,7 +16,7 @@ RSpec.describe PostStatusService, type: :service do
it 'creates a new response status' do
in_reply_to_status = Fabricate(:status)
account = Fabricate(:account)
- text = "test status update"
+ text = 'test status update'
status = subject.call(account, text: text, thread: in_reply_to_status)
@@ -58,7 +58,7 @@ RSpec.describe PostStatusService, type: :service do
boosted_status = Fabricate(:status)
in_reply_to_status = Fabricate(:status, reblog: boosted_status)
account = Fabricate(:account)
- text = "test status update"
+ text = 'test status update'
status = subject.call(account, text: text, thread: in_reply_to_status)
@@ -75,7 +75,7 @@ RSpec.describe PostStatusService, type: :service do
end
it 'creates a status with spoiler text' do
- spoiler_text = "spoiler text"
+ spoiler_text = 'spoiler text'
status = create_status_with_options(spoiler_text: spoiler_text)
@@ -101,14 +101,14 @@ RSpec.describe PostStatusService, type: :service do
status = create_status_with_options(visibility: :private)
expect(status).to be_persisted
- expect(status.visibility).to eq "private"
+ expect(status.visibility).to eq 'private'
end
it 'creates a status with limited visibility for silenced users' do
status = subject.call(Fabricate(:account, silenced: true), text: 'test', visibility: :public)
expect(status).to be_persisted
- expect(status.visibility).to eq "unlisted"
+ expect(status.visibility).to eq 'unlisted'
end
it 'creates a status for the given application' do
@@ -135,7 +135,7 @@ RSpec.describe PostStatusService, type: :service do
allow(ProcessMentionsService).to receive(:new).and_return(mention_service)
account = Fabricate(:account)
- status = subject.call(account, text: "test status update")
+ status = subject.call(account, text: 'test status update')
expect(ProcessMentionsService).to have_received(:new)
expect(mention_service).to have_received(:call).with(status, save_records: false)
@@ -166,7 +166,7 @@ RSpec.describe PostStatusService, type: :service do
allow(ProcessHashtagsService).to receive(:new).and_return(hashtags_service)
account = Fabricate(:account)
- status = subject.call(account, text: "test status update")
+ status = subject.call(account, text: 'test status update')
expect(ProcessHashtagsService).to have_received(:new)
expect(hashtags_service).to have_received(:call).with(status)
@@ -178,7 +178,7 @@ RSpec.describe PostStatusService, type: :service do
account = Fabricate(:account)
- status = subject.call(account, text: "test status update")
+ status = subject.call(account, text: 'test status update')
expect(DistributionWorker).to have_received(:perform_async).with(status.id)
expect(ActivityPub::DistributionWorker).to have_received(:perform_async).with(status.id)
@@ -188,7 +188,7 @@ RSpec.describe PostStatusService, type: :service do
allow(LinkCrawlWorker).to receive(:perform_async)
account = Fabricate(:account)
- status = subject.call(account, text: "test status update")
+ status = subject.call(account, text: 'test status update')
expect(LinkCrawlWorker).to have_received(:perform_async).with(status.id)
end
@@ -199,7 +199,7 @@ RSpec.describe PostStatusService, type: :service do
status = subject.call(
account,
- text: "test status update",
+ text: 'test status update',
media_ids: [media.id]
)
@@ -212,7 +212,7 @@ RSpec.describe PostStatusService, type: :service do
status = subject.call(
account,
- text: "test status update",
+ text: 'test status update',
media_ids: [media.id]
)
@@ -225,7 +225,7 @@ RSpec.describe PostStatusService, type: :service do
expect do
subject.call(
account,
- text: "test status update",
+ text: 'test status update',
media_ids: [
Fabricate(:media_attachment, account: account),
Fabricate(:media_attachment, account: account),
@@ -250,7 +250,7 @@ RSpec.describe PostStatusService, type: :service do
expect do
subject.call(
account,
- text: "test status update",
+ text: 'test status update',
media_ids: [
video,
image,
diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb
index 0dd62c807..6a16928e0 100644
--- a/spec/services/process_mentions_service_spec.rb
+++ b/spec/services/process_mentions_service_spec.rb
@@ -62,7 +62,7 @@ RSpec.describe ProcessMentionsService, type: :service do
context 'with an IDN domain' do
let!(:remote_user) { Fabricate(:account, username: 'sneak', protocol: :activitypub, domain: 'xn--hresiar-mxa.ch', inbox_url: 'http://example.com/inbox') }
- let!(:status) { Fabricate(:status, account: account, text: "Hello @sneak@hæresiar.ch") }
+ let!(:status) { Fabricate(:status, account: account, text: 'Hello @sneak@hæresiar.ch') }
before do
subject.call(status)
@@ -75,7 +75,7 @@ RSpec.describe ProcessMentionsService, type: :service do
context 'with an IDN TLD' do
let!(:remote_user) { Fabricate(:account, username: 'foo', protocol: :activitypub, domain: 'xn--y9a3aq.xn--y9a3aq', inbox_url: 'http://example.com/inbox') }
- let!(:status) { Fabricate(:status, account: account, text: "Hello @foo@հայ.հայ") }
+ let!(:status) { Fabricate(:status, account: account, text: 'Hello @foo@հայ.հայ') }
before do
subject.call(status)
@@ -91,8 +91,8 @@ RSpec.describe ProcessMentionsService, type: :service do
let!(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox', last_webfingered_at: nil) }
before do
- stub_request(:get, "https://example.com/.well-known/host-meta").to_return(status: 404)
- stub_request(:get, "https://example.com/.well-known/webfinger?resource=acct:remote_user@example.com").to_return(status: 500)
+ stub_request(:get, 'https://example.com/.well-known/host-meta').to_return(status: 404)
+ stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:remote_user@example.com').to_return(status: 500)
subject.call(status)
end
diff --git a/spec/services/resolve_account_service_spec.rb b/spec/services/resolve_account_service_spec.rb
index 1df30ea57..192225229 100644
--- a/spec/services/resolve_account_service_spec.rb
+++ b/spec/services/resolve_account_service_spec.rb
@@ -4,11 +4,11 @@ RSpec.describe ResolveAccountService, type: :service do
subject { described_class.new }
before do
- stub_request(:get, "https://example.com/.well-known/host-meta").to_return(status: 404)
- stub_request(:get, "https://quitter.no/avatar/7477-300-20160211190340.png").to_return(request_fixture('avatar.txt'))
- stub_request(:get, "https://ap.example.com/.well-known/webfinger?resource=acct:foo@ap.example.com").to_return(request_fixture('activitypub-webfinger.txt'))
- stub_request(:get, "https://ap.example.com/users/foo").to_return(request_fixture('activitypub-actor.txt'))
- stub_request(:get, "https://ap.example.com/users/foo.atom").to_return(request_fixture('activitypub-feed.txt'))
+ stub_request(:get, 'https://example.com/.well-known/host-meta').to_return(status: 404)
+ stub_request(:get, 'https://quitter.no/avatar/7477-300-20160211190340.png').to_return(request_fixture('avatar.txt'))
+ stub_request(:get, 'https://ap.example.com/.well-known/webfinger?resource=acct:foo@ap.example.com').to_return(request_fixture('activitypub-webfinger.txt'))
+ stub_request(:get, 'https://ap.example.com/users/foo').to_return(request_fixture('activitypub-actor.txt'))
+ stub_request(:get, 'https://ap.example.com/users/foo.atom').to_return(request_fixture('activitypub-feed.txt'))
stub_request(:get, %r{https://ap.example.com/users/foo/\w+}).to_return(status: 404)
stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:hoge@example.com').to_return(status: 410)
end
@@ -56,8 +56,8 @@ RSpec.describe ResolveAccountService, type: :service do
context 'when there is an LRDD endpoint but no resolvable account' do
before do
- stub_request(:get, "https://quitter.no/.well-known/host-meta").to_return(request_fixture('.host-meta.txt'))
- stub_request(:get, "https://quitter.no/.well-known/webfinger?resource=acct:catsrgr8@quitter.no").to_return(status: 404)
+ stub_request(:get, 'https://quitter.no/.well-known/host-meta').to_return(request_fixture('.host-meta.txt'))
+ stub_request(:get, 'https://quitter.no/.well-known/webfinger?resource=acct:catsrgr8@quitter.no').to_return(status: 404)
end
it 'returns nil' do
@@ -67,7 +67,7 @@ RSpec.describe ResolveAccountService, type: :service do
context 'when there is no LRDD endpoint nor resolvable account' do
before do
- stub_request(:get, "https://example.com/.well-known/webfinger?resource=acct:catsrgr8@example.com").to_return(status: 404)
+ stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:catsrgr8@example.com').to_return(status: 404)
end
it 'returns nil' do
@@ -153,7 +153,7 @@ RSpec.describe ResolveAccountService, type: :service do
context 'with multiple types' do
before do
- stub_request(:get, "https://ap.example.com/users/foo").to_return(request_fixture('activitypub-actor-individual.txt'))
+ stub_request(:get, 'https://ap.example.com/users/foo').to_return(request_fixture('activitypub-actor-individual.txt'))
end
it 'returns new remote account' do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 72c9ce8ae..97b8d83c5 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -12,7 +12,7 @@ end
gc_counter = -1
RSpec.configure do |config|
- config.example_status_persistence_file_path = "tmp/rspec/examples.txt"
+ config.example_status_persistence_file_path = 'tmp/rspec/examples.txt'
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
@@ -60,7 +60,7 @@ end
def expect_push_bulk_to_match(klass, matcher)
expect(Sidekiq::Client).to receive(:push_bulk).with(hash_including({
- "class" => klass,
- "args" => matcher,
+ 'class' => klass,
+ 'args' => matcher,
}))
end
--
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/features/log_in_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) { 'Hello :coolcat:
' }
it 'returns records used via shortcodes in text' do
- is_expected.to include(emojo)
+ expect(subject).to include(emojo)
end
end
end
diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb
index d1a94d41a..8889d5f7c 100644
--- a/spec/models/media_attachment_spec.rb
+++ b/spec/models/media_attachment_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { '' }
it 'returns true' do
- is_expected.to be true
+ expect(subject).to be true
end
end
@@ -18,7 +18,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' }
it 'returns false' do
- is_expected.to be false
+ expect(subject).to be false
end
end
end
@@ -35,7 +35,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' }
it 'returns true' do
- is_expected.to be true
+ expect(subject).to be true
end
end
end
@@ -47,7 +47,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { '' }
it 'returns false' do
- is_expected.to be false
+ expect(subject).to be false
end
end
@@ -55,7 +55,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' }
it 'returns true' do
- is_expected.to be false
+ expect(subject).to be false
end
end
end
diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb
index 1e9e45d8d..a8fb77639 100644
--- a/spec/models/notification_spec.rb
+++ b/spec/models/notification_spec.rb
@@ -68,7 +68,7 @@ RSpec.describe Notification, type: :model do
let(:notifications) { [] }
it 'returns []' do
- is_expected.to eq []
+ expect(subject).to eq []
end
end
diff --git a/spec/models/remote_follow_spec.rb b/spec/models/remote_follow_spec.rb
index 5b4c19b5b..c6bbecf25 100644
--- a/spec/models/remote_follow_spec.rb
+++ b/spec/models/remote_follow_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { { acct: 'gargron@quitter.no' } }
it 'returns acct' do
- is_expected.to eq 'gargron@quitter.no'
+ expect(subject).to eq 'gargron@quitter.no'
end
end
@@ -25,7 +25,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { {} }
it do
- is_expected.to be_nil
+ expect(subject).to be_nil
end
end
end
@@ -37,7 +37,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { { acct: 'gargron@quitter.no' } }
it do
- is_expected.to be true
+ expect(subject).to be true
end
end
@@ -45,7 +45,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { {} }
it do
- is_expected.to be false
+ expect(subject).to be false
end
end
end
@@ -61,7 +61,7 @@ RSpec.describe RemoteFollow do
subject { remote_follow.subscribe_address_for(account) }
it 'returns subscribe address' do
- is_expected.to eq 'https://quitter.no/main/ostatussub?profile=https%3A%2F%2Fcb6e6126.ngrok.io%2Fusers%2Falice'
+ expect(subject).to eq 'https://quitter.no/main/ostatussub?profile=https%3A%2F%2Fcb6e6126.ngrok.io%2Fusers%2Falice'
end
end
end
diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb
index 874be4132..317851297 100644
--- a/spec/models/report_spec.rb
+++ b/spec/models/report_spec.rb
@@ -33,7 +33,7 @@ describe Report do
end
it 'assigns to a given account' do
- is_expected.to eq current_account.id
+ expect(subject).to eq current_account.id
end
end
@@ -48,7 +48,7 @@ describe Report do
end
it 'unassigns' do
- is_expected.to be_nil
+ expect(subject).to be_nil
end
end
diff --git a/spec/models/session_activation_spec.rb b/spec/models/session_activation_spec.rb
index 26f2b561a..375199d57 100644
--- a/spec/models/session_activation_spec.rb
+++ b/spec/models/session_activation_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe SessionActivation, type: :model do
let(:id) { nil }
it 'returns nil' do
- is_expected.to be_nil
+ expect(subject).to be_nil
end
end
@@ -54,7 +54,7 @@ RSpec.describe SessionActivation, type: :model do
context 'id exists as session_id' do
it 'returns true' do
- is_expected.to be true
+ expect(subject).to be true
end
end
@@ -64,7 +64,7 @@ RSpec.describe SessionActivation, type: :model do
end
it 'returns false' do
- is_expected.to be false
+ expect(subject).to be false
end
end
end
diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb
index 077223094..86fdf4e08 100644
--- a/spec/models/setting_spec.rb
+++ b/spec/models/setting_spec.rb
@@ -173,7 +173,7 @@ RSpec.describe Setting, type: :model do
let(:enabled) { false }
it 'returns {}' do
- is_expected.to eq({})
+ expect(subject).to eq({})
end
end
@@ -181,7 +181,7 @@ RSpec.describe Setting, type: :model do
let(:enabled) { true }
it 'returns instance of RailsSettings::Default' do
- is_expected.to be_a RailsSettings::Default
+ expect(subject).to be_a RailsSettings::Default
end
end
end
--
cgit