~cytrogen/masto-fe

a610a02d4f19e6c2b218d9792f0dbf272b1bbda3 — Matt Jankowski 2 years ago 9cbda99
Fix RSpec/ScatteredSetup cop (#24848)

M .rubocop_todo.yml => .rubocop_todo.yml +0 -8
@@ 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:

M spec/controllers/activitypub/followers_synchronizations_controller_spec.rb => spec/controllers/activitypub/followers_synchronizations_controller_spec.rb +0 -2
@@ 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


M spec/controllers/activitypub/outboxes_controller_spec.rb => spec/controllers/activitypub/outboxes_controller_spec.rb +0 -2
@@ 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


M spec/controllers/admin/disputes/appeals_controller_spec.rb => spec/controllers/admin/disputes/appeals_controller_spec.rb +5 -5
@@ 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')) }


M spec/controllers/auth/registrations_controller_spec.rb => spec/controllers/auth/registrations_controller_spec.rb +2 -2
@@ 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'

M spec/services/activitypub/process_account_service_spec.rb => spec/services/activitypub/process_account_service_spec.rb +2 -4
@@ 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'],