Autofix Rubocop RSpec/EmptyLineAfterSubject (#23719)

shrike
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/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
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:

View File

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

View File

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

View File

@ -181,6 +181,7 @@ RSpec.describe ActivityPub::RepliesController, type: :controller 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 } }
let(:only_other_accounts) { nil }
context 'with no signature' do

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,6 +30,7 @@ RSpec.describe ActivityPub::Activity::Delete do
context 'when the status has been reblogged' do
describe '#perform' do
subject { described_class.new(json, sender) }
let!(:reblogger) { Fabricate(:account) }
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) }
@ -53,6 +54,7 @@ RSpec.describe ActivityPub::Activity::Delete do
context 'when the status has been reported' do
describe '#perform' do
subject { described_class.new(json, sender) }
let!(:reporter) { Fabricate(:account) }
before do

View File

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

View File

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

View File

@ -409,6 +409,7 @@ RSpec.describe User, type: :model do
describe '#disable!' do
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 }
before do
@ -497,6 +498,7 @@ RSpec.describe User, type: :model do
describe '#active_for_authentication?' do
subject { user.active_for_authentication? }
let(:user) { Fabricate(:user, disabled: disabled, confirmed_at: confirmed_at) }
context 'when user is disabled' do

View File

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

View File

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