1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-23 22:56:20 +09:00

Autofix Rubocop RSpec/EmptyLineAfterFinalLet (#23707)

This commit is contained in:
Nick Schonning 2023-02-18 17:10:19 -05:00 committed by GitHub
parent 2177daeae9
commit 3680e032b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 25 additions and 21 deletions

View File

@ -825,27 +825,6 @@ RSpec/EmptyExampleGroup:
- 'spec/models/web/setting_spec.rb'
- 'spec/services/unmute_service_spec.rb'
# Offense count: 25
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterFinalLet:
Exclude:
- 'spec/config/initializers/rack_attack_spec.rb'
- 'spec/controllers/admin/reports_controller_spec.rb'
- 'spec/controllers/admin/resets_controller_spec.rb'
- 'spec/controllers/api/web/embeds_controller_spec.rb'
- 'spec/controllers/instance_actors_controller_spec.rb'
- 'spec/controllers/intents_controller_spec.rb'
- 'spec/controllers/settings/applications_controller_spec.rb'
- 'spec/controllers/settings/sessions_controller_spec.rb'
- 'spec/controllers/shares_controller_spec.rb'
- 'spec/lib/status_filter_spec.rb'
- 'spec/models/account_spec.rb'
- 'spec/models/account_statuses_cleanup_policy_spec.rb'
- 'spec/services/fetch_resource_service_spec.rb'
- 'spec/services/import_service_spec.rb'
- 'spec/services/precompute_feed_service_spec.rb'
- 'spec/validators/poll_validator_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowConsecutiveOneLiners.

View File

@ -36,11 +36,13 @@ describe Rack::Attack do
context 'for exact path' do
let(:path) { '/auth' }
it_behaves_like 'throttled endpoint'
end
context 'for path with format' do
let(:path) { '/auth.html' }
it_behaves_like 'throttled endpoint'
end
end
@ -51,6 +53,7 @@ describe Rack::Attack do
context 'for exact path' do
let(:path) { '/api/v1/accounts' }
it_behaves_like 'throttled endpoint'
end
@ -71,11 +74,13 @@ describe Rack::Attack do
context 'for exact path' do
let(:path) { '/auth/sign_in' }
it_behaves_like 'throttled endpoint'
end
context 'for path with format' do
let(:path) { '/auth/sign_in.html' }
it_behaves_like 'throttled endpoint'
end
end

View File

@ -4,6 +4,7 @@ describe Admin::ReportsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
before do
sign_in user, scope: :user
end

View File

@ -4,6 +4,7 @@ describe Admin::ResetsController do
render_views
let(:account) { Fabricate(:account) }
before do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user
end

View File

@ -6,6 +6,7 @@ describe Api::Web::EmbedsController do
render_views
let(:user) { Fabricate(:user) }
before { sign_in user }
describe 'POST #create' do

View File

@ -43,11 +43,13 @@ RSpec.describe InstanceActorsController, type: :controller do
context 'without authorized fetch mode' do
let(:authorized_fetch_mode) { false }
it_behaves_like 'shared behavior'
end
context 'with authorized fetch mode' do
let(:authorized_fetch_mode) { true }
it_behaves_like 'shared behavior'
end
end

View File

@ -4,6 +4,7 @@ RSpec.describe IntentsController, type: :controller do
render_views
let(:user) { Fabricate(:user) }
before { sign_in user, scope: :user }
describe 'GET #show' do

View File

@ -175,6 +175,7 @@ describe Settings::ApplicationsController do
describe 'regenerate' do
let(:token) { user.token_for_app(app) }
before do
expect(token).to_not be_nil
post :regenerate, params: { id: app.id }

View File

@ -5,6 +5,7 @@ describe Settings::SessionsController do
let(:user) { Fabricate(:user) }
let(:session_activation) { Fabricate(:session_activation, user: user) }
before { sign_in user, scope: :user }
describe 'DELETE #destroy' do

View File

@ -4,6 +4,7 @@ describe SharesController do
render_views
let(:user) { Fabricate(:user) }
before { sign_in user }
describe 'GTE #show' do

View File

@ -32,6 +32,7 @@ describe StatusFilter do
context 'with real account' do
let(:account) { Fabricate(:account) }
subject { described_class.new(status, account) }
context 'when there are no connections' do

View File

@ -3,6 +3,7 @@ require 'rails_helper'
RSpec.describe Account, type: :model do
context do
let(:bob) { Fabricate(:account, username: 'bob') }
subject { Fabricate(:account) }
describe '#suspend!' do

View File

@ -134,6 +134,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
describe '#invalidate_last_inspected' do
let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }
let(:status) { Fabricate(:status, id: 10, account: account) }
subject { account_statuses_cleanup_policy.invalidate_last_inspected(status, action) }
before do

View File

@ -8,6 +8,7 @@ RSpec.describe FetchResourceService, type: :service do
context 'with blank url' do
let(:url) { '' }
it { is_expected.to be_nil }
end

View File

@ -18,6 +18,7 @@ RSpec.describe ImportService, type: :service do
describe 'when no accounts are muted' do
let(:import) { Import.create(account: account, type: 'muting', data: csv) }
it 'mutes the listed accounts, including notifications' do
subject.call(import)
expect(account.muting.count).to eq 2
@ -55,6 +56,7 @@ RSpec.describe ImportService, type: :service do
describe 'when no accounts are muted' do
let(:import) { Import.create(account: account, type: 'muting', data: csv) }
it 'mutes the listed accounts, respecting notifications' do
subject.call(import)
expect(account.muting.count).to eq 2
@ -95,6 +97,7 @@ RSpec.describe ImportService, type: :service do
describe 'when no accounts are followed' do
let(:import) { Import.create(account: account, type: 'following', data: csv) }
it 'follows the listed accounts, including boosts' do
subject.call(import)
@ -136,6 +139,7 @@ RSpec.describe ImportService, type: :service do
describe 'when no accounts are followed' do
let(:import) { Import.create(account: account, type: 'following', data: csv) }
it 'follows the listed accounts, respecting boosts' do
subject.call(import)
expect(account.following.count).to eq 1
@ -224,6 +228,7 @@ RSpec.describe ImportService, type: :service do
describe 'when no bookmarks are set' do
let(:import) { Import.create(account: account, type: 'bookmarks', data: csv) }
it 'adds the toots the user has access to to bookmarks' do
local_status = Fabricate(:status, account: local_account, uri: 'https://local.com/users/foo/statuses/42', id: 42, local: true)
subject.call(import)

View File

@ -7,6 +7,7 @@ RSpec.describe PrecomputeFeedService, type: :service do
describe 'call' do
let(:account) { Fabricate(:account) }
it 'fills a user timeline with statuses' do
account = Fabricate(:account)
status = Fabricate(:status, account: account)

View File

@ -20,6 +20,7 @@ RSpec.describe PollValidator, type: :validator do
context 'expires just 5 min ago' do
let(:expires_at) { 5.minutes.from_now }
it 'not calls errors add' do
expect(errors).not_to have_received(:add)
end