Fix RSpec/ScatteredSetup cop (#24848)

pull/24852/head
Matt Jankowski 2023-05-11 04:32:09 -04:00 committed by GitHub
parent 9cbda99941
commit a610a02d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 23 deletions

View File

@ -648,14 +648,6 @@ RSpec/RepeatedExampleGroupDescription:
- 'spec/controllers/admin/reports/actions_controller_spec.rb'
- 'spec/policies/report_note_policy_spec.rb'
RSpec/ScatteredSetup:
Exclude:
- 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb'
- 'spec/controllers/activitypub/outboxes_controller_spec.rb'
- 'spec/controllers/admin/disputes/appeals_controller_spec.rb'
- 'spec/controllers/auth/registrations_controller_spec.rb'
- 'spec/services/activitypub/process_account_service_spec.rb'
# This cop supports safe autocorrection (--autocorrect).
RSpec/SharedContext:
Exclude:

View File

@ -14,9 +14,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController do
follower_2.follow!(account)
follower_3.follow!(account)
follower_4.follow!(account)
end
before do
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
end

View File

@ -27,9 +27,7 @@ RSpec.describe ActivityPub::OutboxesController do
Fabricate(:status, account: account, visibility: :private)
Fabricate(:status, account: account, visibility: :direct)
Fabricate(:status, account: account, visibility: :limited)
end
before do
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
end

View File

@ -5,16 +5,16 @@ require 'rails_helper'
RSpec.describe Admin::Disputes::AppealsController do
render_views
before { sign_in current_user, scope: :user }
before do
sign_in current_user, scope: :user
target_account.suspend!
end
let(:target_account) { Fabricate(:account) }
let(:strike) { Fabricate(:account_warning, target_account: target_account, action: :suspend) }
let(:appeal) { Fabricate(:appeal, strike: strike, account: target_account) }
before do
target_account.suspend!
end
describe 'POST #approve' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -101,6 +101,8 @@ RSpec.describe Auth::RegistrationsController do
before do
session[:registration_form_time] = 5.seconds.ago
request.env['devise.mapping'] = Devise.mappings[:user]
end
around do |example|
@ -109,8 +111,6 @@ RSpec.describe Auth::RegistrationsController do
end
end
before { request.env['devise.mapping'] = Devise.mappings[:user] }
context do
subject do
Setting.registrations_mode = 'open'

View File

@ -139,10 +139,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
end
context 'when Accounts referencing other accounts' do
before do
stub_const 'ActivityPub::ProcessAccountService::DISCOVERIES_PER_REQUEST', 5
end
let(:payload) do
{
'@context': ['https://www.w3.org/ns/activitystreams'],
@ -155,6 +151,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
end
before do
stub_const 'ActivityPub::ProcessAccountService::DISCOVERIES_PER_REQUEST', 5
8.times do |i|
actor_json = {
'@context': ['https://www.w3.org/ns/activitystreams'],