mirror of https://github.com/tootsuite/mastodon
Fix RSpec/ScatteredSetup cop (#24848)
parent
9cbda99941
commit
a610a02d4f
|
@ -648,14 +648,6 @@ RSpec/RepeatedExampleGroupDescription:
|
||||||
- 'spec/controllers/admin/reports/actions_controller_spec.rb'
|
- 'spec/controllers/admin/reports/actions_controller_spec.rb'
|
||||||
- 'spec/policies/report_note_policy_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).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
RSpec/SharedContext:
|
RSpec/SharedContext:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|
|
@ -14,9 +14,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController do
|
||||||
follower_2.follow!(account)
|
follower_2.follow!(account)
|
||||||
follower_3.follow!(account)
|
follower_3.follow!(account)
|
||||||
follower_4.follow!(account)
|
follower_4.follow!(account)
|
||||||
end
|
|
||||||
|
|
||||||
before do
|
|
||||||
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
|
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,7 @@ RSpec.describe ActivityPub::OutboxesController do
|
||||||
Fabricate(:status, account: account, visibility: :private)
|
Fabricate(:status, account: account, visibility: :private)
|
||||||
Fabricate(:status, account: account, visibility: :direct)
|
Fabricate(:status, account: account, visibility: :direct)
|
||||||
Fabricate(:status, account: account, visibility: :limited)
|
Fabricate(:status, account: account, visibility: :limited)
|
||||||
end
|
|
||||||
|
|
||||||
before do
|
|
||||||
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
|
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,16 @@ require 'rails_helper'
|
||||||
RSpec.describe Admin::Disputes::AppealsController do
|
RSpec.describe Admin::Disputes::AppealsController do
|
||||||
render_views
|
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(:target_account) { Fabricate(:account) }
|
||||||
let(:strike) { Fabricate(:account_warning, target_account: target_account, action: :suspend) }
|
let(:strike) { Fabricate(:account_warning, target_account: target_account, action: :suspend) }
|
||||||
let(:appeal) { Fabricate(:appeal, strike: strike, account: target_account) }
|
let(:appeal) { Fabricate(:appeal, strike: strike, account: target_account) }
|
||||||
|
|
||||||
before do
|
|
||||||
target_account.suspend!
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'POST #approve' do
|
describe 'POST #approve' do
|
||||||
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,8 @@ RSpec.describe Auth::RegistrationsController do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
session[:registration_form_time] = 5.seconds.ago
|
session[:registration_form_time] = 5.seconds.ago
|
||||||
|
|
||||||
|
request.env['devise.mapping'] = Devise.mappings[:user]
|
||||||
end
|
end
|
||||||
|
|
||||||
around do |example|
|
around do |example|
|
||||||
|
@ -109,8 +111,6 @@ RSpec.describe Auth::RegistrationsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
before { request.env['devise.mapping'] = Devise.mappings[:user] }
|
|
||||||
|
|
||||||
context do
|
context do
|
||||||
subject do
|
subject do
|
||||||
Setting.registrations_mode = 'open'
|
Setting.registrations_mode = 'open'
|
||||||
|
|
|
@ -139,10 +139,6 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when Accounts referencing other accounts' do
|
context 'when Accounts referencing other accounts' do
|
||||||
before do
|
|
||||||
stub_const 'ActivityPub::ProcessAccountService::DISCOVERIES_PER_REQUEST', 5
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:payload) do
|
let(:payload) do
|
||||||
{
|
{
|
||||||
'@context': ['https://www.w3.org/ns/activitystreams'],
|
'@context': ['https://www.w3.org/ns/activitystreams'],
|
||||||
|
@ -155,6 +151,8 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_const 'ActivityPub::ProcessAccountService::DISCOVERIES_PER_REQUEST', 5
|
||||||
|
|
||||||
8.times do |i|
|
8.times do |i|
|
||||||
actor_json = {
|
actor_json = {
|
||||||
'@context': ['https://www.w3.org/ns/activitystreams'],
|
'@context': ['https://www.w3.org/ns/activitystreams'],
|
||||||
|
|
Loading…
Reference in New Issue