Autofix Rubocop RSpec/EmptyLineAfterSubject (#23719)

This commit is contained in:
Nick Schonning 2023-02-19 20:46:00 -05:00 committed by GitHub
parent dbc6d7b276
commit bd1d57c230
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 19 additions and 21 deletions

View file

@ -817,27 +817,6 @@ RSpec/EmptyExampleGroup:
- 'spec/models/web/setting_spec.rb' - 'spec/models/web/setting_spec.rb'
- 'spec/services/unmute_service_spec.rb' - 'spec/services/unmute_service_spec.rb'
# Offense count: 19
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterSubject:
Exclude:
- 'spec/controllers/activitypub/collections_controller_spec.rb'
- 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb'
- 'spec/controllers/activitypub/outboxes_controller_spec.rb'
- 'spec/controllers/activitypub/replies_controller_spec.rb'
- 'spec/controllers/admin/reports/actions_controller_spec.rb'
- 'spec/controllers/api/web/embeds_controller_spec.rb'
- 'spec/controllers/emojis_controller_spec.rb'
- 'spec/controllers/follower_accounts_controller_spec.rb'
- 'spec/controllers/following_accounts_controller_spec.rb'
- 'spec/controllers/relationships_controller_spec.rb'
- 'spec/lib/activitypub/activity/delete_spec.rb'
- 'spec/lib/activitypub/activity/flag_spec.rb'
- 'spec/models/admin/account_action_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/services/fetch_remote_status_service_spec.rb'
- 'spec/workers/refollow_worker_spec.rb'
# Offense count: 178 # Offense count: 178
# Configuration parameters: CountAsOne. # Configuration parameters: CountAsOne.
RSpec/ExampleLength: RSpec/ExampleLength:

View file

@ -38,6 +38,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
let(:remote_account) { nil } let(:remote_account) { nil }
subject(:response) { get :show, params: { id: 'featured', account_username: account.username } } subject(:response) { get :show, params: { id: 'featured', account_username: account.username } }
subject(:body) { body_as_json } subject(:body) { body_as_json }
it 'returns http success' do it 'returns http success' do

View file

@ -35,6 +35,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll
let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/instance') } let(:remote_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/instance') }
subject(:response) { get :show, params: { account_username: account.username } } subject(:response) { get :show, params: { account_username: account.username } }
subject(:body) { body_as_json } subject(:body) { body_as_json }
it 'returns http success' do it 'returns http success' do

View file

@ -36,6 +36,7 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do
let(:remote_account) { nil } let(:remote_account) { nil }
subject(:response) { get :show, params: { account_username: account.username, page: page } } subject(:response) { get :show, params: { account_username: account.username, page: page } }
subject(:body) { body_as_json } subject(:body) { body_as_json }
context 'with page not requested' do context 'with page not requested' do

View file

@ -181,6 +181,7 @@ RSpec.describe ActivityPub::RepliesController, type: :controller do
describe 'GET #index' do describe 'GET #index' do
subject(:response) { get :index, params: { account_username: status.account.username, status_id: status.id, only_other_accounts: only_other_accounts } } subject(:response) { get :index, params: { account_username: status.account.username, status_id: status.id, only_other_accounts: only_other_accounts } }
let(:only_other_accounts) { nil } let(:only_other_accounts) { nil }
context 'with no signature' do context 'with no signature' do

View file

@ -123,11 +123,13 @@ describe Admin::Reports::ActionsController do
context 'action as submit button' do context 'action as submit button' do
subject { post :create, params: { report_id: report.id, text: text, action => '' } } subject { post :create, params: { report_id: report.id, text: text, action => '' } }
it_behaves_like 'all action types' it_behaves_like 'all action types'
end end
context 'action as submit button' do context 'action as submit button' do
subject { post :create, params: { report_id: report.id, text: text, moderation_action: action } } subject { post :create, params: { report_id: report.id, text: text, moderation_action: action } }
it_behaves_like 'all action types' it_behaves_like 'all action types'
end end
end end

View file

@ -11,6 +11,7 @@ describe Api::Web::EmbedsController do
describe 'POST #create' do describe 'POST #create' do
subject(:response) { post :create, params: { url: url } } subject(:response) { post :create, params: { url: url } }
subject(:body) { JSON.parse(response.body, symbolize_names: true) } subject(:body) { JSON.parse(response.body, symbolize_names: true) }
context 'when successfully finds status' do context 'when successfully finds status' do

View file

@ -7,6 +7,7 @@ describe EmojisController do
describe 'GET #show' do describe 'GET #show' do
subject(:response) { get :show, params: { id: emoji.id, format: :json } } subject(:response) { get :show, params: { id: emoji.id, format: :json } }
subject(:body) { JSON.parse(response.body, symbolize_names: true) } subject(:body) { JSON.parse(response.body, symbolize_names: true) }
it 'returns the right response' do it 'returns the right response' do

View file

@ -38,6 +38,7 @@ describe FollowerAccountsController do
context 'when format is json' do context 'when format is json' do
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
subject(:body) { JSON.parse(response.body) } subject(:body) { JSON.parse(response.body) }
context 'with page' do context 'with page' do

View file

@ -38,6 +38,7 @@ describe FollowingAccountsController do
context 'when format is json' do context 'when format is json' do
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
subject(:body) { JSON.parse(response.body) } subject(:body) { JSON.parse(response.body) }
context 'with page' do context 'with page' do

View file

@ -51,6 +51,7 @@ describe RelationshipsController do
context 'when select parameter is not provided' do context 'when select parameter is not provided' do
subject { patch :update } subject { patch :update }
include_examples 'redirects back to followers page' include_examples 'redirects back to followers page'
end end

View file

@ -30,6 +30,7 @@ RSpec.describe ActivityPub::Activity::Delete do
context 'when the status has been reblogged' do context 'when the status has been reblogged' do
describe '#perform' do describe '#perform' do
subject { described_class.new(json, sender) } subject { described_class.new(json, sender) }
let!(:reblogger) { Fabricate(:account) } let!(:reblogger) { Fabricate(:account) }
let!(:follower) { Fabricate(:account, username: 'follower', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } let!(:follower) { Fabricate(:account, username: 'follower', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
let!(:reblog) { Fabricate(:status, account: reblogger, reblog: status) } let!(:reblog) { Fabricate(:status, account: reblogger, reblog: status) }
@ -53,6 +54,7 @@ RSpec.describe ActivityPub::Activity::Delete do
context 'when the status has been reported' do context 'when the status has been reported' do
describe '#perform' do describe '#perform' do
subject { described_class.new(json, sender) } subject { described_class.new(json, sender) }
let!(:reporter) { Fabricate(:account) } let!(:reporter) { Fabricate(:account) }
before do before do

View file

@ -110,6 +110,7 @@ RSpec.describe ActivityPub::Activity::Flag do
describe '#perform with a defined uri' do describe '#perform with a defined uri' do
subject { described_class.new(json, sender) } subject { described_class.new(json, sender) }
let(:flag_id) { 'http://example.com/reports/1' } let(:flag_id) { 'http://example.com/reports/1' }
before do before do

View file

@ -5,6 +5,7 @@ RSpec.describe Admin::AccountAction, type: :model do
describe '#save!' do describe '#save!' do
subject { account_action.save! } subject { account_action.save! }
let(:account) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } let(:account) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
let(:target_account) { Fabricate(:account) } let(:target_account) { Fabricate(:account) }
let(:type) { 'disable' } let(:type) { 'disable' }

View file

@ -409,6 +409,7 @@ RSpec.describe User, type: :model do
describe '#disable!' do describe '#disable!' do
subject(:user) { Fabricate(:user, disabled: false, current_sign_in_at: current_sign_in_at, last_sign_in_at: nil) } subject(:user) { Fabricate(:user, disabled: false, current_sign_in_at: current_sign_in_at, last_sign_in_at: nil) }
let(:current_sign_in_at) { Time.zone.now } let(:current_sign_in_at) { Time.zone.now }
before do before do
@ -497,6 +498,7 @@ RSpec.describe User, type: :model do
describe '#active_for_authentication?' do describe '#active_for_authentication?' do
subject { user.active_for_authentication? } subject { user.active_for_authentication? }
let(:user) { Fabricate(:user, disabled: disabled, confirmed_at: confirmed_at) } let(:user) { Fabricate(:user, disabled: disabled, confirmed_at: confirmed_at) }
context 'when user is disabled' do context 'when user is disabled' do

View file

@ -16,6 +16,7 @@ RSpec.describe FetchRemoteStatusService, type: :service do
context 'protocol is :activitypub' do context 'protocol is :activitypub' do
subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) } subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) }
let(:prefetched_body) { Oj.dump(note) } let(:prefetched_body) { Oj.dump(note) }
before do before do

View file

@ -4,6 +4,7 @@ require 'rails_helper'
describe RefollowWorker do describe RefollowWorker do
subject { described_class.new } subject { described_class.new }
let(:account) { Fabricate(:account, domain: 'example.org', protocol: :activitypub) } let(:account) { Fabricate(:account, domain: 'example.org', protocol: :activitypub) }
let(:alice) { Fabricate(:account, domain: nil, username: 'alice') } let(:alice) { Fabricate(:account, domain: nil, username: 'alice') }
let(:bob) { Fabricate(:account, domain: nil, username: 'bob') } let(:bob) { Fabricate(:account, domain: nil, username: 'bob') }