From 1f98eae1cf916a18007a26e1740b0e65aa7ff752 Mon Sep 17 00:00:00 2001 From: aus-social <42644106+aus-social@users.noreply.github.com> Date: Thu, 4 Oct 2018 20:36:53 +1000 Subject: [PATCH] Lint pass (#8876) --- config/boot.rb | 2 +- config/initializers/omniauth.rb | 3 +-- config/initializers/ostatus.rb | 2 +- config/initializers/twitter_regex.rb | 1 - config/initializers/vapid.rb | 1 - .../20160306172223_create_doorkeeper_tables.rb | 4 ++-- .../20161006213403_rails_settings_migration.rb | 2 +- ...170606113804_change_tag_search_index_to_btree.rb | 1 - ...20170716191202_add_hide_notifications_to_mute.rb | 2 +- db/migrate/20170920032311_fix_reblogs_in_feeds.rb | 2 +- db/migrate/20171028221157_add_reblogs_to_follows.rb | 2 +- db/schema.rb | 1 - spec/controllers/accounts_controller_spec.rb | 4 ++-- spec/controllers/admin/accounts_controller_spec.rb | 1 - .../admin/email_domain_blocks_controller_spec.rb | 4 ++-- spec/controllers/admin/invites_controller_spec.rb | 2 +- .../admin/report_notes_controller_spec.rb | 11 +++++------ .../admin/reported_statuses_controller_spec.rb | 2 +- spec/controllers/api/v1/accounts_controller_spec.rb | 4 ++-- .../favourited_by_accounts_controller_spec.rb | 1 - .../controllers/api/v1/streaming_controller_spec.rb | 3 +-- .../api/v1/timelines/home_controller_spec.rb | 2 +- .../api/v1/timelines/public_controller_spec.rb | 2 +- spec/controllers/api/web/embeds_controller_spec.rb | 2 +- spec/controllers/application_controller_spec.rb | 4 ++-- .../auth/confirmations_controller_spec.rb | 2 +- spec/controllers/invites_controller_spec.rb | 2 +- .../controllers/remote_unfollows_controller_spec.rb | 6 +++--- .../settings/applications_controller_spec.rb | 1 - .../settings/migrations_controller_spec.rb | 2 -- .../confirmations_controller_spec.rb | 2 +- spec/fabricators/account_fabricator.rb | 2 +- spec/fabricators/list_fabricator.rb | 2 +- spec/fabricators/relay_fabricator.rb | 2 +- spec/fabricators/site_upload_fabricator.rb | 1 - spec/lib/feed_manager_spec.rb | 2 +- spec/lib/formatter_spec.rb | 13 ++++++------- spec/lib/language_detector_spec.rb | 2 +- spec/lib/ostatus/atom_serializer_spec.rb | 2 +- spec/lib/request_spec.rb | 2 +- spec/models/account_moderation_note_spec.rb | 1 - spec/models/admin/action_log_spec.rb | 1 - spec/models/backup_spec.rb | 1 - spec/models/conversation_mute_spec.rb | 1 - spec/models/custom_emoji_spec.rb | 2 +- spec/models/custom_filter_spec.rb | 1 - spec/models/list_account_spec.rb | 1 - spec/models/list_spec.rb | 1 - spec/models/media_attachment_spec.rb | 2 +- spec/models/mute_spec.rb | 1 - spec/models/preview_card_spec.rb | 1 - spec/models/remote_follow_spec.rb | 4 ++-- spec/models/web/setting_spec.rb | 1 - .../activitypub/process_collection_service_spec.rb | 4 ++-- spec/services/fetch_atom_service_spec.rb | 2 +- spec/views/stream_entries/show.html.haml_spec.rb | 2 +- 56 files changed, 55 insertions(+), 79 deletions(-) diff --git a/config/boot.rb b/config/boot.rb index 593f575e9a..beb45a5ee2 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,6 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bundler/setup' # Set up gems listed in the Gemfile. require 'bootsnap' # Speed up boot time by caching expensive operations. Bootsnap.setup( diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 85fb812506..21b58eb5b3 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -38,7 +38,7 @@ Devise.setup do |config| saml_options = options saml_options[:assertion_consumer_service_url] = ENV['SAML_ACS_URL'] if ENV['SAML_ACS_URL'] saml_options[:issuer] = ENV['SAML_ISSUER'] if ENV['SAML_ISSUER'] - saml_options[:idp_sso_target_url] = ENV['SAML_IDP_SSO_TARGET_URL'] if ENV['SAML_IDP_SSO_TARGET_URL'] + saml_options[:idp_sso_target_url] = ENV['SAML_IDP_SSO_TARGET_URL'] if ENV['SAML_IDP_SSO_TARGET_URL'] saml_options[:idp_sso_target_url_runtime_params] = ENV['SAML_IDP_SSO_TARGET_PARAMS'] if ENV['SAML_IDP_SSO_TARGET_PARAMS'] # FIXME: Should be parsable Hash saml_options[:idp_cert] = ENV['SAML_IDP_CERT'] if ENV['SAML_IDP_CERT'] saml_options[:idp_cert_fingerprint] = ENV['SAML_IDP_CERT_FINGERPRINT'] if ENV['SAML_IDP_CERT_FINGERPRINT'] @@ -62,5 +62,4 @@ Devise.setup do |config| saml_options[:uid_attribute] = ENV['SAML_UID_ATTRIBUTE'] if ENV['SAML_UID_ATTRIBUTE'] config.omniauth :saml, saml_options end - end diff --git a/config/initializers/ostatus.rb b/config/initializers/ostatus.rb index 5773b72903..757f1f7355 100644 --- a/config/initializers/ostatus.rb +++ b/config/initializers/ostatus.rb @@ -7,7 +7,7 @@ web_host = ENV.fetch('WEB_DOMAIN') { host } alternate_domains = ENV.fetch('ALTERNATE_DOMAINS') { '' } Rails.application.configure do - https = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true' + https = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true' config.x.local_domain = host config.x.web_domain = web_host diff --git a/config/initializers/twitter_regex.rb b/config/initializers/twitter_regex.rb index 76b23f4168..0e8f5bfeb4 100644 --- a/config/initializers/twitter_regex.rb +++ b/config/initializers/twitter_regex.rb @@ -1,6 +1,5 @@ module Twitter class Regex - REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}\(\)\?]/iou REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou REGEXEN[:valid_url_balanced_parens] = / diff --git a/config/initializers/vapid.rb b/config/initializers/vapid.rb index 618f5a3fbb..7dd870c8b7 100644 --- a/config/initializers/vapid.rb +++ b/config/initializers/vapid.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true Rails.application.configure do - # You can generate the keys using the following command (first is the private key, second is the public one) # You should only generate this once per instance. If you later decide to change it, all push subscription will # be invalidated, requiring the users to access the website again to resubscribe. diff --git a/db/migrate/20160306172223_create_doorkeeper_tables.rb b/db/migrate/20160306172223_create_doorkeeper_tables.rb index 9e173a43f3..462343e888 100644 --- a/db/migrate/20160306172223_create_doorkeeper_tables.rb +++ b/db/migrate/20160306172223_create_doorkeeper_tables.rb @@ -34,12 +34,12 @@ class CreateDoorkeeperTables < ActiveRecord::Migration[4.2] # https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator # # t.text :token, null: false - t.string :token, null: false + t.string :token, null: false t.string :refresh_token t.integer :expires_in t.datetime :revoked_at - t.datetime :created_at, null: false + t.datetime :created_at, null: false t.string :scopes end diff --git a/db/migrate/20161006213403_rails_settings_migration.rb b/db/migrate/20161006213403_rails_settings_migration.rb index 3b2e637fc7..42875d7cbd 100644 --- a/db/migrate/20161006213403_rails_settings_migration.rb +++ b/db/migrate/20161006213403_rails_settings_migration.rb @@ -7,7 +7,7 @@ end class RailsSettingsMigration < MIGRATION_BASE_CLASS def self.up create_table :settings do |t| - t.string :var, :null => false + t.string :var, :null => false t.text :value t.references :target, :null => false, :polymorphic => true t.timestamps :null => true diff --git a/db/migrate/20170606113804_change_tag_search_index_to_btree.rb b/db/migrate/20170606113804_change_tag_search_index_to_btree.rb index 5248e17202..979df2e744 100644 --- a/db/migrate/20170606113804_change_tag_search_index_to_btree.rb +++ b/db/migrate/20170606113804_change_tag_search_index_to_btree.rb @@ -1,5 +1,4 @@ class ChangeTagSearchIndexToBtree < ActiveRecord::Migration[5.1] - def up remove_index :tags, name: :hashtag_search_index execute 'CREATE INDEX hashtag_search_index ON tags (name text_pattern_ops);' diff --git a/db/migrate/20170716191202_add_hide_notifications_to_mute.rb b/db/migrate/20170716191202_add_hide_notifications_to_mute.rb index 0410938c9b..a498396b75 100644 --- a/db/migrate/20170716191202_add_hide_notifications_to_mute.rb +++ b/db/migrate/20170716191202_add_hide_notifications_to_mute.rb @@ -8,7 +8,7 @@ class AddHideNotificationsToMute < ActiveRecord::Migration[5.1] def up add_column_with_default :mutes, :hide_notifications, :boolean, default: true, allow_null: false end - + def down remove_column :mutes, :hide_notifications end diff --git a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb index 439c5fca08..5654bf6f87 100644 --- a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb +++ b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb @@ -28,7 +28,7 @@ class FixReblogsInFeeds < ActiveRecord::Migration[5.1] -- So, first, we iterate over the user's feed to find any reblogs. local items = redis.call('zrange', timeline_key, 0, -1, 'withscores') - + for i = 1, #items, 2 do local reblogged_id = items[i] local reblogging_id = items[i + 1] diff --git a/db/migrate/20171028221157_add_reblogs_to_follows.rb b/db/migrate/20171028221157_add_reblogs_to_follows.rb index 4b5d5b7ff3..3b2e46ed8a 100644 --- a/db/migrate/20171028221157_add_reblogs_to_follows.rb +++ b/db/migrate/20171028221157_add_reblogs_to_follows.rb @@ -11,7 +11,7 @@ class AddReblogsToFollows < ActiveRecord::Migration[5.1] add_column_with_default :follow_requests, :show_reblogs, :boolean, default: true, allow_null: false end end - + def down remove_column :follows, :show_reblogs remove_column :follow_requests, :show_reblogs diff --git a/db/schema.rb b/db/schema.rb index f3b06f7c0c..577296a6ae 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2018_08_20_232245) do - # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb index 18c249c07e..3ba5d8aec2 100644 --- a/spec/controllers/accounts_controller_spec.rb +++ b/spec/controllers/accounts_controller_spec.rb @@ -3,8 +3,8 @@ require 'rails_helper' RSpec.describe AccountsController, type: :controller do render_views - let(:alice) { Fabricate(:account, username: 'alice') } - let(:eve) { Fabricate(:user) } + let(:alice) { Fabricate(:account, username: 'alice') } + let(:eve) { Fabricate(:user) } describe 'GET #show' do let!(:status1) { Status.create!(account: alice, text: 'Hello world') } diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index 197e019fed..fa2786c9b1 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -75,7 +75,6 @@ RSpec.describe Admin::AccountsController, type: :controller do end end - describe 'POST #subscribe' do subject { post :subscribe, params: { id: account.id } } diff --git a/spec/controllers/admin/email_domain_blocks_controller_spec.rb b/spec/controllers/admin/email_domain_blocks_controller_spec.rb index 133d38ff10..52db56f4e8 100644 --- a/spec/controllers/admin/email_domain_blocks_controller_spec.rb +++ b/spec/controllers/admin/email_domain_blocks_controller_spec.rb @@ -40,7 +40,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do describe 'POST #create' do it 'blocks the domain when succeeded to save' do - post :create, params: { email_domain_block: { domain: 'example.com'} } + post :create, params: { email_domain_block: { domain: 'example.com' } } expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.created_msg') expect(response).to redirect_to(admin_email_domain_blocks_path) @@ -50,7 +50,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do describe 'DELETE #destroy' do it 'unblocks the domain' do email_domain_block = Fabricate(:email_domain_block) - delete :destroy, params: { id: email_domain_block.id } + delete :destroy, params: { id: email_domain_block.id } expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.destroyed_msg') expect(response).to redirect_to(admin_email_domain_blocks_path) diff --git a/spec/controllers/admin/invites_controller_spec.rb b/spec/controllers/admin/invites_controller_spec.rb index e7d9954118..34b51a6aa7 100644 --- a/spec/controllers/admin/invites_controller_spec.rb +++ b/spec/controllers/admin/invites_controller_spec.rb @@ -24,7 +24,7 @@ describe Admin::InvitesController do subject { post :create, params: { invite: { max_uses: '10', expires_in: 1800 } } } it 'succeeds to create a invite' do - expect{ subject }.to change { Invite.count }.by(1) + expect { subject }.to change { Invite.count }.by(1) expect(subject).to redirect_to admin_invites_path expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) end diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb index 2c32303fb3..ec5872c7d2 100644 --- a/spec/controllers/admin/report_notes_controller_spec.rb +++ b/spec/controllers/admin/report_notes_controller_spec.rb @@ -15,7 +15,6 @@ describe Admin::ReportNotesController do let(:report) { Fabricate(:report, action_taken: action_taken, action_taken_by_account_id: account_id) } context 'when parameter is valid' do - context 'when report is unsolved' do let(:action_taken) { false } let(:account_id) { nil } @@ -24,7 +23,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } } it 'creates a report note and resolves report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).to be_action_taken expect(subject).to redirect_to admin_reports_path end @@ -34,7 +33,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id } } } it 'creates a report note and does not resolve report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).not_to be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -49,7 +48,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } } it 'creates a report note and unresolves report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).not_to be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -59,7 +58,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id } } } it 'creates a report note and does not unresolve report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).to be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -84,7 +83,7 @@ describe Admin::ReportNotesController do let!(:report_note) { Fabricate(:report_note) } it 'deletes note' do - expect{ subject }.to change{ ReportNote.count }.by(-1) + expect { subject }.to change { ReportNote.count }.by(-1) expect(subject).to redirect_to admin_report_path(report_note.report) end end diff --git a/spec/controllers/admin/reported_statuses_controller_spec.rb b/spec/controllers/admin/reported_statuses_controller_spec.rb index 7adbf36b9c..c358506d6d 100644 --- a/spec/controllers/admin/reported_statuses_controller_spec.rb +++ b/spec/controllers/admin/reported_statuses_controller_spec.rb @@ -13,7 +13,7 @@ describe Admin::ReportedStatusesController do describe 'POST #create' do subject do - -> { post :create, params: { :report_id => report, action => '', :form_status_batch => { status_ids: status_ids } } } + -> { post :create, params: { :report_id => report, action => '', :form_status_batch => { status_ids: status_ids } } } end let(:action) { 'nsfw_on' } diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb index 3e54e88a5b..c506fb5f01 100644 --- a/spec/controllers/api/v1/accounts_controller_spec.rb +++ b/spec/controllers/api/v1/accounts_controller_spec.rb @@ -154,7 +154,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do before do user.account.follow!(other_account) - post :mute, params: {id: other_account.id } + post :mute, params: { id: other_account.id } end it 'returns http success' do @@ -182,7 +182,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do before do user.account.follow!(other_account) - post :mute, params: {id: other_account.id, notifications: false } + post :mute, params: { id: other_account.id, notifications: false } end it 'returns http success' do diff --git a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb index 23b5d7de92..40f75c700f 100644 --- a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb +++ b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb @@ -25,7 +25,6 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control expect(response.headers['Link'].links.size).to eq(2) end end - end context 'without an oauth token' do diff --git a/spec/controllers/api/v1/streaming_controller_spec.rb b/spec/controllers/api/v1/streaming_controller_spec.rb index daf2807e7f..4ab409a541 100644 --- a/spec/controllers/api/v1/streaming_controller_spec.rb +++ b/spec/controllers/api/v1/streaming_controller_spec.rb @@ -31,7 +31,7 @@ describe Api::V1::StreamingController do describe 'GET #index' do it 'redirects to streaming host' do - get :index, params: {access_token: 'deadbeef', stream: 'public'} + get :index, params: { access_token: 'deadbeef', stream: 'public' } expect(response).to have_http_status(301) request_uri = URI.parse(request.url) redirect_to_uri = URI.parse(response.location) @@ -42,5 +42,4 @@ describe Api::V1::StreamingController do end end end - end diff --git a/spec/controllers/api/v1/timelines/home_controller_spec.rb b/spec/controllers/api/v1/timelines/home_controller_spec.rb index a667c33fad..63d624c355 100644 --- a/spec/controllers/api/v1/timelines/home_controller_spec.rb +++ b/spec/controllers/api/v1/timelines/home_controller_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe Api::V1::Timelines::HomeController do render_views - let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice'), current_sign_in_at: 1.day.ago) } + let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice'), current_sign_in_at: 1.day.ago) } before do allow(controller).to receive(:doorkeeper_token) { token } diff --git a/spec/controllers/api/v1/timelines/public_controller_spec.rb b/spec/controllers/api/v1/timelines/public_controller_spec.rb index 68d87bbcbd..a0f778cdce 100644 --- a/spec/controllers/api/v1/timelines/public_controller_spec.rb +++ b/spec/controllers/api/v1/timelines/public_controller_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe Api::V1::Timelines::PublicController do render_views - let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) } + let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) } before do allow(controller).to receive(:doorkeeper_token) { token } diff --git a/spec/controllers/api/web/embeds_controller_spec.rb b/spec/controllers/api/web/embeds_controller_spec.rb index 6b7297189a..a8fc1718f6 100644 --- a/spec/controllers/api/web/embeds_controller_spec.rb +++ b/spec/controllers/api/web/embeds_controller_spec.rb @@ -14,7 +14,7 @@ describe Api::Web::EmbedsController do context 'when successfully finds status' do let(:status) { Fabricate(:status) } - let(:url) { "http://#{ Rails.configuration.x.web_domain }/@#{status.account.username}/#{status.id}" } + let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" } it 'returns a right response' do expect(response).to have_http_status :ok diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index d158625e63..33cc710871 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -94,7 +94,7 @@ describe ApplicationController, type: :controller do describe 'helper_method :current_theme' do it 'returns "default" when theme wasn\'t changed in admin settings' do - allow(Setting).to receive(:default_settings).and_return({'theme' => 'default'}) + allow(Setting).to receive(:default_settings).and_return({ 'theme' => 'default' }) expect(controller.view_context.current_theme).to eq 'default' end @@ -197,7 +197,7 @@ describe ApplicationController, type: :controller do describe 'raise_not_found' do it 'raises error' do controller.params[:unmatched_route] = 'unmatched' - expect{ controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched') + expect { controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched') end end diff --git a/spec/controllers/auth/confirmations_controller_spec.rb b/spec/controllers/auth/confirmations_controller_spec.rb index 35eed4f513..e9a471fc5a 100644 --- a/spec/controllers/auth/confirmations_controller_spec.rb +++ b/spec/controllers/auth/confirmations_controller_spec.rb @@ -67,7 +67,7 @@ describe Auth::ConfirmationsController, type: :controller do end describe 'PATCH #finish_signup' do - subject { patch :finish_signup, params: { user: { email: email }} } + subject { patch :finish_signup, params: { user: { email: email } } } let(:user) { Fabricate(:user) } before do diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb index 9f5ab67c30..76e617e6b6 100644 --- a/spec/controllers/invites_controller_spec.rb +++ b/spec/controllers/invites_controller_spec.rb @@ -43,7 +43,7 @@ describe InvitesController do let(:user) { Fabricate(:user, moderator: false, admin: true) } it 'succeeds to create a invite' do - expect{ subject }.to change { Invite.count }.by(1) + expect { subject }.to change { Invite.count }.by(1) expect(subject).to redirect_to invites_path expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) end diff --git a/spec/controllers/remote_unfollows_controller_spec.rb b/spec/controllers/remote_unfollows_controller_spec.rb index 223ed64af6..a1a55ede0b 100644 --- a/spec/controllers/remote_unfollows_controller_spec.rb +++ b/spec/controllers/remote_unfollows_controller_spec.rb @@ -14,11 +14,11 @@ describe RemoteUnfollowsController do before do sign_in current_user current_account.follow!(remote_account) - stub_request(:post, 'http://example.com/inbox'){ { status: 200 } } + stub_request(:post, 'http://example.com/inbox') { { status: 200 } } end context 'when successfully unfollow remote account' do - let(:acct) {"acct:#{ remote_account.username }@#{ remote_account.domain }"} + let(:acct) { "acct:#{remote_account.username}@#{remote_account.domain}" } it do is_expected.to render_template :success @@ -27,7 +27,7 @@ describe RemoteUnfollowsController do end context 'when fails to unfollow remote account' do - let(:acct) {"acct:#{ remote_account.username + '_test' }@#{ remote_account.domain }"} + let(:acct) { "acct:#{remote_account.username + '_test'}@#{remote_account.domain}" } it do is_expected.to render_template :error diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb index f87107695f..fd4b100717 100644 --- a/spec/controllers/settings/applications_controller_spec.rb +++ b/spec/controllers/settings/applications_controller_spec.rb @@ -21,7 +21,6 @@ describe Settings::ApplicationsController do end end - describe 'GET #show' do it 'returns http success' do get :show, params: { id: app.id } diff --git a/spec/controllers/settings/migrations_controller_spec.rb b/spec/controllers/settings/migrations_controller_spec.rb index a621bcf1ce..4d814a45e2 100644 --- a/spec/controllers/settings/migrations_controller_spec.rb +++ b/spec/controllers/settings/migrations_controller_spec.rb @@ -10,7 +10,6 @@ describe Settings::MigrationsController do end describe 'GET #show' do - context 'when user is not sign in' do subject { get :show } @@ -45,7 +44,6 @@ describe Settings::MigrationsController do end describe 'PUT #update' do - context 'when user is not sign in' do subject { put :update } diff --git a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb index 7612bf90ec..478f245855 100644 --- a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb +++ b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb @@ -50,7 +50,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do describe 'when form_two_factor_confirmation parameter is not provided' do it 'raises ActionController::ParameterMissing' do - expect { post :create, params: { } }.to raise_error(ActionController::ParameterMissing) + expect { post :create, params: {} }.to raise_error(ActionController::ParameterMissing) end end diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb index 7aa983f821..e092e6c099 100644 --- a/spec/fabricators/account_fabricator.rb +++ b/spec/fabricators/account_fabricator.rb @@ -6,5 +6,5 @@ Fabricator(:account) do username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } } last_webfingered_at { Time.now.utc } public_key { public_key } - private_key { private_key} + private_key { private_key } end diff --git a/spec/fabricators/list_fabricator.rb b/spec/fabricators/list_fabricator.rb index 2a61b317b8..c3db690fa4 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 3f8726f6b3..488913f772 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" - state :idle + state :idle end diff --git a/spec/fabricators/site_upload_fabricator.rb b/spec/fabricators/site_upload_fabricator.rb index 8f4e43ac9b..4a171486f6 100644 --- a/spec/fabricators/site_upload_fabricator.rb +++ b/spec/fabricators/site_upload_fabricator.rb @@ -1,3 +1,2 @@ Fabricator(:site_upload) do - end diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb index 7535e144d7..64e109aecd 100644 --- a/spec/lib/feed_manager_spec.rb +++ b/spec/lib/feed_manager_spec.rb @@ -393,7 +393,7 @@ RSpec.describe FeedManager do end it 'sends push updates' do - status = Fabricate(:status) + status = Fabricate(:status) FeedManager.instance.push_to_home(receiver, status) diff --git a/spec/lib/formatter_spec.rb b/spec/lib/formatter_spec.rb index 0c2248cae5..ec4a6493df 100644 --- a/spec/lib/formatter_spec.rb +++ b/spec/lib/formatter_spec.rb @@ -170,12 +170,11 @@ RSpec.describe Formatter do end end - describe '#format_spoiler' do subject { Formatter.instance.format_spoiler(status) } context 'given a post containing plain text' do - let(:status) { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) } + let(:status) { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) } it 'Returns the spoiler text' do is_expected.to eq 'Secret!' @@ -184,7 +183,7 @@ RSpec.describe Formatter do context 'given a post with an emoji shortcode at the start' do let!(:emoji) { Fabricate(:custom_emoji) } - let(:status) { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) } + let(:status) { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) } let(:text) { ':coolcat: Beep boop' } it 'converts the shortcode to an image tag' do @@ -207,7 +206,7 @@ RSpec.describe Formatter do end context 'given a post containing plain text' do - let(:status) { Fabricate(:status, text: 'text', uri: nil) } + let(:status) { Fabricate(:status, text: 'text', uri: nil) } it 'paragraphizes the text' do is_expected.to eq '
text
' @@ -215,7 +214,7 @@ RSpec.describe Formatter do end context 'given a post containing line feeds' do - let(:status) { Fabricate(:status, text: "line\nfeed", uri: nil) } + let(:status) { Fabricate(:status, text: "line\nfeed", uri: nil) } it 'removes line feeds' do is_expected.not_to include "\n" @@ -367,7 +366,7 @@ RSpec.describe Formatter do subject { Formatter.instance.plaintext(status) } context 'given a post with local status' do - let(:status) { Fabricate(:status, text: 'a text by a nerd who uses an HTML tag in text
', uri: nil) } + 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
' @@ -375,7 +374,7 @@ RSpec.describe Formatter do end context 'given a post with remote status' do - let(:status) { Fabricate(:status, account: remote_account, text: '') } + let(:status) { Fabricate(:status, account: remote_account, text: '') } it 'returns tag-stripped text' do is_expected.to eq '' diff --git a/spec/lib/language_detector_spec.rb b/spec/lib/language_detector_spec.rb index d00d2a0e61..cdc51a656c 100644 --- a/spec/lib/language_detector_spec.rb +++ b/spec/lib/language_detector_spec.rb @@ -90,7 +90,7 @@ describe LanguageDetector do end it 'uses nil when account is present but has no locale' do - result = described_class.instance.detect('', account_without_user_locale) + result = described_class.instance.detect('', account_without_user_locale) expect(result).to eq nil end diff --git a/spec/lib/ostatus/atom_serializer_spec.rb b/spec/lib/ostatus/atom_serializer_spec.rb index 0bd22880e0..3bc4b7efb7 100644 --- a/spec/lib/ostatus/atom_serializer_spec.rb +++ b/spec/lib/ostatus/atom_serializer_spec.rb @@ -880,7 +880,7 @@ RSpec.describe OStatus::AtomSerializer do ProcessInteractionService.new.call(envelope, block.target_account) - expect{ block.reload }.to raise_error ActiveRecord::RecordNotFound + expect { block.reload }.to raise_error ActiveRecord::RecordNotFound end end diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb index 939ac006ae..8cc5d90ce3 100644 --- a/spec/lib/request_spec.rb +++ b/spec/lib/request_spec.rb @@ -84,7 +84,7 @@ describe Request do allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM) .and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM)) .and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:db8::face"], :PF_INET6, :SOCK_STREAM)) - expect{ subject.perform }.to raise_error Mastodon::ValidationError + expect { subject.perform }.to raise_error Mastodon::ValidationError end end end diff --git a/spec/models/account_moderation_note_spec.rb b/spec/models/account_moderation_note_spec.rb index 16983b2e36..69bd5500a5 100644 --- a/spec/models/account_moderation_note_spec.rb +++ b/spec/models/account_moderation_note_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe AccountModerationNote, type: :model do - end diff --git a/spec/models/admin/action_log_spec.rb b/spec/models/admin/action_log_spec.rb index 59206a36b3..81d7e1be3a 100644 --- a/spec/models/admin/action_log_spec.rb +++ b/spec/models/admin/action_log_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Admin::ActionLog, type: :model do - end diff --git a/spec/models/backup_spec.rb b/spec/models/backup_spec.rb index fabcdc845a..45230986d7 100644 --- a/spec/models/backup_spec.rb +++ b/spec/models/backup_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Backup, type: :model do - end diff --git a/spec/models/conversation_mute_spec.rb b/spec/models/conversation_mute_spec.rb index b602e80c19..3fc2915d4f 100644 --- a/spec/models/conversation_mute_spec.rb +++ b/spec/models/conversation_mute_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe ConversationMute, type: :model do - end diff --git a/spec/models/custom_emoji_spec.rb b/spec/models/custom_emoji_spec.rb index 87367df500..320a258d34 100644 --- a/spec/models/custom_emoji_spec.rb +++ b/spec/models/custom_emoji_spec.rb @@ -4,7 +4,7 @@ RSpec.describe CustomEmoji, type: :model do describe '#search' do let(:custom_emoji) { Fabricate(:custom_emoji, shortcode: shortcode) } - subject { described_class.search(search_term) } + subject { described_class.search(search_term) } context 'shortcode is exact' do let(:shortcode) { 'blobpats' } diff --git a/spec/models/custom_filter_spec.rb b/spec/models/custom_filter_spec.rb index 1024542e7b..3943dd5f1a 100644 --- a/spec/models/custom_filter_spec.rb +++ b/spec/models/custom_filter_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe CustomFilter, type: :model do - end diff --git a/spec/models/list_account_spec.rb b/spec/models/list_account_spec.rb index a132e09b0e..a0cf02efe2 100644 --- a/spec/models/list_account_spec.rb +++ b/spec/models/list_account_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe ListAccount, type: :model do - end diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb index c302482b43..b780bb1de0 100644 --- a/spec/models/list_spec.rb +++ b/spec/models/list_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe List, type: :model do - end diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb index cb1cee5186..266cd49203 100644 --- a/spec/models/media_attachment_spec.rb +++ b/spec/models/media_attachment_spec.rb @@ -131,7 +131,7 @@ RSpec.describe MediaAttachment, type: :model do expect(media.file.meta["original"]["aspect"]).to eq 1.5 expect(media.file.meta["small"]["width"]).to eq 490 expect(media.file.meta["small"]["height"]).to eq 327 - expect(media.file.meta["small"]["aspect"]).to eq 490.0/327 + expect(media.file.meta["small"]["aspect"]).to eq 490.0 / 327 end end diff --git a/spec/models/mute_spec.rb b/spec/models/mute_spec.rb index 83ba793b2b..38a87bdf4a 100644 --- a/spec/models/mute_spec.rb +++ b/spec/models/mute_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Mute, type: :model do - end diff --git a/spec/models/preview_card_spec.rb b/spec/models/preview_card_spec.rb index 14ef23923c..45233d1d4f 100644 --- a/spec/models/preview_card_spec.rb +++ b/spec/models/preview_card_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe PreviewCard, type: :model do - end diff --git a/spec/models/remote_follow_spec.rb b/spec/models/remote_follow_spec.rb index 72c580f9f1..ed2667b28a 100644 --- a/spec/models/remote_follow_spec.rb +++ b/spec/models/remote_follow_spec.rb @@ -34,7 +34,7 @@ RSpec.describe RemoteFollow do subject { remote_follow.valid? } context 'attrs with acct' do - let(:attrs) { { acct: 'gargron@quitter.no' }} + let(:attrs) { { acct: 'gargron@quitter.no' } } it do is_expected.to be true @@ -42,7 +42,7 @@ RSpec.describe RemoteFollow do end context 'attrs without acct' do - let(:attrs) { { } } + let(:attrs) { {} } it do is_expected.to be false diff --git a/spec/models/web/setting_spec.rb b/spec/models/web/setting_spec.rb index 90e7695aa7..6657d4030f 100644 --- a/spec/models/web/setting_spec.rb +++ b/spec/models/web/setting_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Web::Setting, type: :model do - end diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index e46f0ae450..bbe97d2112 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -34,7 +34,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do end it 'processes payload with actor if valid signature exists' do - payload['signature'] = {'type' => 'RsaSignature2017'} + payload['signature'] = { 'type' => 'RsaSignature2017' } expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(actor) expect(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash)) @@ -43,7 +43,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do end it 'does not process payload if invalid signature exists' do - payload['signature'] = {'type' => 'RsaSignature2017'} + payload['signature'] = { 'type' => 'RsaSignature2017' } expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(nil) expect(ActivityPub::Activity).not_to receive(:factory) diff --git a/spec/services/fetch_atom_service_spec.rb b/spec/services/fetch_atom_service_spec.rb index bb233c12d1..30e5b0935a 100644 --- a/spec/services/fetch_atom_service_spec.rb +++ b/spec/services/fetch_atom_service_spec.rb @@ -57,7 +57,7 @@ RSpec.describe FetchAtomService, type: :service do context 'content type is application/atom+xml' do let(:content_type) { 'application/atom+xml' } - it { is_expected.to eq [url, {:prefetched_body=>""}, :ostatus] } + it { is_expected.to eq [url, { :prefetched_body => "" }, :ostatus] } end context 'content_type is json' do diff --git a/spec/views/stream_entries/show.html.haml_spec.rb b/spec/views/stream_entries/show.html.haml_spec.rb index d06bb7abb5..e084195969 100644 --- a/spec/views/stream_entries/show.html.haml_spec.rb +++ b/spec/views/stream_entries/show.html.haml_spec.rb @@ -50,7 +50,7 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d assign(:account, alice) assign(:type, reply.stream_entry.activity_type.downcase) assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob) ) - assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1)}]) + assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1) }]) render