Update rubocop-rspec to version 3.6.0 (#34497)
				
					
				
			This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
# This configuration was generated by
 | 
			
		||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-offense-counts --no-auto-gen-timestamp`
 | 
			
		||||
# using RuboCop version 1.75.2.
 | 
			
		||||
# using RuboCop version 1.75.3.
 | 
			
		||||
# The point is for the user to remove these configuration records
 | 
			
		||||
# one by one as the offenses are removed from the code base.
 | 
			
		||||
# Note that changes in the inspected code, or installation of new
 | 
			
		||||
 
 | 
			
		||||
@@ -743,7 +743,7 @@ GEM
 | 
			
		||||
      rspec-mocks (~> 3.0)
 | 
			
		||||
      sidekiq (>= 5, < 9)
 | 
			
		||||
    rspec-support (3.13.2)
 | 
			
		||||
    rubocop (1.75.2)
 | 
			
		||||
    rubocop (1.75.3)
 | 
			
		||||
      json (~> 2.3)
 | 
			
		||||
      language_server-protocol (~> 3.17.0.2)
 | 
			
		||||
      lint_roller (~> 1.1.0)
 | 
			
		||||
@@ -773,7 +773,7 @@ GEM
 | 
			
		||||
      rack (>= 1.1)
 | 
			
		||||
      rubocop (>= 1.75.0, < 2.0)
 | 
			
		||||
      rubocop-ast (>= 1.38.0, < 2.0)
 | 
			
		||||
    rubocop-rspec (3.5.0)
 | 
			
		||||
    rubocop-rspec (3.6.0)
 | 
			
		||||
      lint_roller (~> 1.1)
 | 
			
		||||
      rubocop (~> 1.72, >= 1.72.1)
 | 
			
		||||
    rubocop-rspec_rails (2.31.0)
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  shared_examples 'respond_with_error' do |code|
 | 
			
		||||
  shared_examples 'error response' do |code|
 | 
			
		||||
    it "returns http #{code} for http and renders template" do
 | 
			
		||||
      subject
 | 
			
		||||
 | 
			
		||||
@@ -51,7 +51,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      post 'success'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 422
 | 
			
		||||
    it_behaves_like 'error response', 422
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'helper_method :current_account' do
 | 
			
		||||
@@ -123,7 +123,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      get 'routing_error'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 404
 | 
			
		||||
    it_behaves_like 'error response', 404
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'with ActiveRecord::RecordNotFound' do
 | 
			
		||||
@@ -132,7 +132,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      get 'record_not_found'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 404
 | 
			
		||||
    it_behaves_like 'error response', 404
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'with ActionController::InvalidAuthenticityToken' do
 | 
			
		||||
@@ -141,7 +141,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      get 'invalid_authenticity_token'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 422
 | 
			
		||||
    it_behaves_like 'error response', 422
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'before_action :check_suspension' do
 | 
			
		||||
@@ -186,7 +186,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      get 'route_forbidden'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 403
 | 
			
		||||
    it_behaves_like 'error response', 403
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'not_found' do
 | 
			
		||||
@@ -201,7 +201,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      get 'route_not_found'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 404
 | 
			
		||||
    it_behaves_like 'error response', 404
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'gone' do
 | 
			
		||||
@@ -216,7 +216,7 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      get 'route_gone'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 410
 | 
			
		||||
    it_behaves_like 'error response', 410
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'unprocessable_entity' do
 | 
			
		||||
@@ -231,6 +231,6 @@ RSpec.describe ApplicationController do
 | 
			
		||||
      get 'route_unprocessable_entity'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'respond_with_error', 422
 | 
			
		||||
    it_behaves_like 'error response', 422
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ require 'rails_helper'
 | 
			
		||||
RSpec.describe Auth::RegistrationsController do
 | 
			
		||||
  render_views
 | 
			
		||||
 | 
			
		||||
  shared_examples 'checks for enabled registrations' do |path|
 | 
			
		||||
  shared_examples 'registration mode based responses' do |path|
 | 
			
		||||
    context 'when in single user mode and open for registration' do
 | 
			
		||||
      before do
 | 
			
		||||
        Setting.registrations_mode = 'open'
 | 
			
		||||
@@ -156,7 +156,7 @@ RSpec.describe Auth::RegistrationsController do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'checks for enabled registrations', :new
 | 
			
		||||
    it_behaves_like 'registration mode based responses', :new
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'POST #create' do
 | 
			
		||||
@@ -378,7 +378,7 @@ RSpec.describe Auth::RegistrationsController do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'checks for enabled registrations', :create
 | 
			
		||||
    it_behaves_like 'registration mode based responses', :create
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'DELETE #destroy' do
 | 
			
		||||
 
 | 
			
		||||
@@ -59,10 +59,10 @@ RSpec.describe Localized do
 | 
			
		||||
      sign_in(user)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'default locale'
 | 
			
		||||
    it_behaves_like 'default locale'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'with a user who has not signed in' do
 | 
			
		||||
    include_examples 'default locale'
 | 
			
		||||
    it_behaves_like 'default locale'
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ RSpec.describe RelationshipsController do
 | 
			
		||||
  describe 'PATCH #update' do
 | 
			
		||||
    let(:alice) { Fabricate(:account, username: 'alice', domain: 'example.com') }
 | 
			
		||||
 | 
			
		||||
    shared_examples 'redirects back to followers page' do
 | 
			
		||||
    shared_examples 'general behavior for followed user' do
 | 
			
		||||
      it 'redirects back to followers page' do
 | 
			
		||||
        alice.follow!(user.account)
 | 
			
		||||
 | 
			
		||||
@@ -49,7 +49,7 @@ RSpec.describe RelationshipsController do
 | 
			
		||||
    context 'when select parameter is not provided' do
 | 
			
		||||
      subject { patch :update }
 | 
			
		||||
 | 
			
		||||
      include_examples 'redirects back to followers page'
 | 
			
		||||
      it_behaves_like 'general behavior for followed user'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when select parameter is provided' do
 | 
			
		||||
@@ -83,7 +83,7 @@ RSpec.describe RelationshipsController do
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'redirects back to followers page'
 | 
			
		||||
      it_behaves_like 'general behavior for followed user'
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -162,7 +162,7 @@ RSpec.describe Settings::ImportsController do
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'export failed rows', "Account address,Show boosts,Notify on new posts,Languages\nfoo@bar,true,false,\nuser@bar,false,true,\"fr, de\"\n"
 | 
			
		||||
      it_behaves_like 'export failed rows', "Account address,Show boosts,Notify on new posts,Languages\nfoo@bar,true,false,\nuser@bar,false,true,\"fr, de\"\n"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with blocks' do
 | 
			
		||||
@@ -175,7 +175,7 @@ RSpec.describe Settings::ImportsController do
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'export failed rows', "foo@bar\nuser@bar\n"
 | 
			
		||||
      it_behaves_like 'export failed rows', "foo@bar\nuser@bar\n"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with mutes' do
 | 
			
		||||
@@ -188,7 +188,7 @@ RSpec.describe Settings::ImportsController do
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'export failed rows', "Account address,Hide notifications\nfoo@bar,true\nuser@bar,false\n"
 | 
			
		||||
      it_behaves_like 'export failed rows', "Account address,Hide notifications\nfoo@bar,true\nuser@bar,false\n"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with domain blocks' do
 | 
			
		||||
@@ -201,7 +201,7 @@ RSpec.describe Settings::ImportsController do
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'export failed rows', "bad.domain\nevil.domain\n"
 | 
			
		||||
      it_behaves_like 'export failed rows', "bad.domain\nevil.domain\n"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with bookmarks' do
 | 
			
		||||
@@ -214,7 +214,7 @@ RSpec.describe Settings::ImportsController do
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'export failed rows', "https://foo.com/1\nhttps://foo.com/2\n"
 | 
			
		||||
      it_behaves_like 'export failed rows', "https://foo.com/1\nhttps://foo.com/2\n"
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with lists' do
 | 
			
		||||
@@ -227,7 +227,7 @@ RSpec.describe Settings::ImportsController do
 | 
			
		||||
        ]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'export failed rows', "Amigos,user@example.com\nFrenemies,user@org.org\n"
 | 
			
		||||
      it_behaves_like 'export failed rows', "Amigos,user@example.com\nFrenemies,user@org.org\n"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ RSpec.describe Settings::TwoFactorAuthentication::ConfirmationsController do
 | 
			
		||||
            get :new, session: { challenge_passed_at: Time.now.utc, new_otp_secret: 'thisisasecretforthespecofnewview' }
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          include_examples 'renders expected page'
 | 
			
		||||
          it_behaves_like 'renders expected page'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        it 'redirects if a new otp_secret has not been set in the session' do
 | 
			
		||||
@@ -94,7 +94,7 @@ RSpec.describe Settings::TwoFactorAuthentication::ConfirmationsController do
 | 
			
		||||
              .to include(I18n.t('otp_authentication.wrong_code'))
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          include_examples 'renders expected page'
 | 
			
		||||
          it_behaves_like 'renders expected page'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        private
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ RSpec.describe CacheBuster do
 | 
			
		||||
  let(:purge_url) { 'https://example.com/test_purge' }
 | 
			
		||||
 | 
			
		||||
  describe '#bust' do
 | 
			
		||||
    shared_examples 'makes_request' do
 | 
			
		||||
    shared_examples 'cache busting request' do
 | 
			
		||||
      it 'makes an HTTP purging request' do
 | 
			
		||||
        method = http_method&.to_sym || :get
 | 
			
		||||
        stub_request(method, purge_url).to_return(status: 200)
 | 
			
		||||
@@ -28,28 +28,28 @@ RSpec.describe CacheBuster do
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when using default options' do
 | 
			
		||||
      include_examples 'makes_request'
 | 
			
		||||
      it_behaves_like 'cache busting request'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when specifying a secret header' do
 | 
			
		||||
      let(:secret_header) { 'X-Purge-Secret' }
 | 
			
		||||
      let(:secret) { SecureRandom.hex(20) }
 | 
			
		||||
 | 
			
		||||
      include_examples 'makes_request'
 | 
			
		||||
      it_behaves_like 'cache busting request'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when specifying a PURGE method' do
 | 
			
		||||
      let(:http_method) { 'purge' }
 | 
			
		||||
 | 
			
		||||
      context 'when not using headers' do
 | 
			
		||||
        include_examples 'makes_request'
 | 
			
		||||
        it_behaves_like 'cache busting request'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'when specifying a secret header' do
 | 
			
		||||
        let(:secret_header) { 'X-Purge-Secret' }
 | 
			
		||||
        let(:secret) { SecureRandom.hex(20) }
 | 
			
		||||
 | 
			
		||||
        include_examples 'makes_request'
 | 
			
		||||
        it_behaves_like 'cache busting request'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -44,14 +44,14 @@ RSpec.describe Fasp::Request do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#get' do
 | 
			
		||||
    include_examples 'a provider request', :get
 | 
			
		||||
    it_behaves_like 'a provider request', :get
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#post' do
 | 
			
		||||
    include_examples 'a provider request', :post
 | 
			
		||||
    it_behaves_like 'a provider request', :post
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#delete' do
 | 
			
		||||
    include_examples 'a provider request', :delete
 | 
			
		||||
    it_behaves_like 'a provider request', :delete
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,7 @@ RSpec.describe LinkDetailsExtractor do
 | 
			
		||||
        </html>
 | 
			
		||||
      HTML
 | 
			
		||||
 | 
			
		||||
      include_examples 'structured data'
 | 
			
		||||
      it_behaves_like 'structured data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with the first tag is invalid JSON' do
 | 
			
		||||
@@ -136,7 +136,7 @@ RSpec.describe LinkDetailsExtractor do
 | 
			
		||||
        </html>
 | 
			
		||||
      HTML
 | 
			
		||||
 | 
			
		||||
      include_examples 'structured data'
 | 
			
		||||
      it_behaves_like 'structured data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with the first tag is null' do
 | 
			
		||||
@@ -154,7 +154,7 @@ RSpec.describe LinkDetailsExtractor do
 | 
			
		||||
        </html>
 | 
			
		||||
      HTML
 | 
			
		||||
 | 
			
		||||
      include_examples 'structured data'
 | 
			
		||||
      it_behaves_like 'structured data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with preceding block of unsupported LD+JSON' do
 | 
			
		||||
@@ -194,7 +194,7 @@ RSpec.describe LinkDetailsExtractor do
 | 
			
		||||
        </html>
 | 
			
		||||
      HTML
 | 
			
		||||
 | 
			
		||||
      include_examples 'structured data'
 | 
			
		||||
      it_behaves_like 'structured data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with unsupported in same block LD+JSON' do
 | 
			
		||||
@@ -218,7 +218,7 @@ RSpec.describe LinkDetailsExtractor do
 | 
			
		||||
        </html>
 | 
			
		||||
      HTML
 | 
			
		||||
 | 
			
		||||
      include_examples 'structured data'
 | 
			
		||||
      it_behaves_like 'structured data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with author names as array' do
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ RSpec.describe Mastodon::CLI::IpBlocks do
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with valid IP addresses' do
 | 
			
		||||
      include_examples 'ip address blocking'
 | 
			
		||||
      it_behaves_like 'ip address blocking'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when a specified IP address is already blocked' do
 | 
			
		||||
@@ -84,7 +84,7 @@ RSpec.describe Mastodon::CLI::IpBlocks do
 | 
			
		||||
            .to('sign_up_requires_approval')
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        include_examples 'ip address blocking'
 | 
			
		||||
        it_behaves_like 'ip address blocking'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@@ -101,25 +101,25 @@ RSpec.describe Mastodon::CLI::IpBlocks do
 | 
			
		||||
    context 'with --comment option' do
 | 
			
		||||
      let(:options) { { severity: 'no_access', comment: 'Spam' } }
 | 
			
		||||
 | 
			
		||||
      include_examples 'ip address blocking'
 | 
			
		||||
      it_behaves_like 'ip address blocking'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with --duration option' do
 | 
			
		||||
      let(:options) { { severity: 'no_access', duration: 10.days } }
 | 
			
		||||
 | 
			
		||||
      include_examples 'ip address blocking'
 | 
			
		||||
      it_behaves_like 'ip address blocking'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with "sign_up_requires_approval" severity' do
 | 
			
		||||
      let(:options) { { severity: 'sign_up_requires_approval' } }
 | 
			
		||||
 | 
			
		||||
      include_examples 'ip address blocking'
 | 
			
		||||
      it_behaves_like 'ip address blocking'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with "sign_up_block" severity' do
 | 
			
		||||
      let(:options) { { severity: 'sign_up_block' } }
 | 
			
		||||
 | 
			
		||||
      include_examples 'ip address blocking'
 | 
			
		||||
      it_behaves_like 'ip address blocking'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when a specified IP address fails to be blocked' do
 | 
			
		||||
 
 | 
			
		||||
@@ -207,18 +207,18 @@ RSpec.describe Mastodon::RedisConfiguration do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'setting a different driver'
 | 
			
		||||
    include_examples 'setting a namespace'
 | 
			
		||||
    include_examples 'sentinel support'
 | 
			
		||||
    it_behaves_like 'setting a different driver'
 | 
			
		||||
    it_behaves_like 'setting a namespace'
 | 
			
		||||
    it_behaves_like 'sentinel support'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#sidekiq' do
 | 
			
		||||
    subject { redis_environment.sidekiq }
 | 
			
		||||
 | 
			
		||||
    include_examples 'secondary configuration', 'SIDEKIQ'
 | 
			
		||||
    include_examples 'setting a different driver'
 | 
			
		||||
    include_examples 'setting a namespace'
 | 
			
		||||
    include_examples 'sentinel support', 'SIDEKIQ'
 | 
			
		||||
    it_behaves_like 'secondary configuration', 'SIDEKIQ'
 | 
			
		||||
    it_behaves_like 'setting a different driver'
 | 
			
		||||
    it_behaves_like 'setting a namespace'
 | 
			
		||||
    it_behaves_like 'sentinel support', 'SIDEKIQ'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#cache' do
 | 
			
		||||
@@ -256,8 +256,8 @@ RSpec.describe Mastodon::RedisConfiguration do
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'secondary configuration', 'CACHE'
 | 
			
		||||
    include_examples 'setting a different driver'
 | 
			
		||||
    include_examples 'sentinel support', 'CACHE'
 | 
			
		||||
    it_behaves_like 'secondary configuration', 'CACHE'
 | 
			
		||||
    it_behaves_like 'setting a different driver'
 | 
			
		||||
    it_behaves_like 'sentinel support', 'CACHE'
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
    let(:notification) { Notification.create!(account: receiver.account, activity: mention) }
 | 
			
		||||
    let(:mail) { prepared_mailer_for(receiver.account).mention }
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject', 'notification_mailer.mention.subject', name: 'bob'
 | 
			
		||||
    it_behaves_like 'localized subject', 'notification_mailer.mention.subject', name: 'bob'
 | 
			
		||||
 | 
			
		||||
    it 'renders the email' do
 | 
			
		||||
      expect(mail)
 | 
			
		||||
@@ -47,8 +47,8 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
        .and have_standard_headers('mention').for(receiver)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to non functional user'
 | 
			
		||||
    include_examples 'delivery without status'
 | 
			
		||||
    it_behaves_like 'delivery to non functional user'
 | 
			
		||||
    it_behaves_like 'delivery without status'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'follow' do
 | 
			
		||||
@@ -56,7 +56,7 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
    let(:notification) { Notification.create!(account: receiver.account, activity: follow) }
 | 
			
		||||
    let(:mail) { prepared_mailer_for(receiver.account).follow }
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject', 'notification_mailer.follow.subject', name: 'bob'
 | 
			
		||||
    it_behaves_like 'localized subject', 'notification_mailer.follow.subject', name: 'bob'
 | 
			
		||||
 | 
			
		||||
    it 'renders the email' do
 | 
			
		||||
      expect(mail)
 | 
			
		||||
@@ -66,7 +66,7 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
        .and have_standard_headers('follow').for(receiver)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to non functional user'
 | 
			
		||||
    it_behaves_like 'delivery to non functional user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'favourite' do
 | 
			
		||||
@@ -74,7 +74,7 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
    let(:notification) { Notification.create!(account: receiver.account, activity: favourite) }
 | 
			
		||||
    let(:mail) { prepared_mailer_for(own_status.account).favourite }
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject', 'notification_mailer.favourite.subject', name: 'bob'
 | 
			
		||||
    it_behaves_like 'localized subject', 'notification_mailer.favourite.subject', name: 'bob'
 | 
			
		||||
 | 
			
		||||
    it 'renders the email' do
 | 
			
		||||
      expect(mail)
 | 
			
		||||
@@ -86,8 +86,8 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
        .and have_standard_headers('favourite').for(receiver)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to non functional user'
 | 
			
		||||
    include_examples 'delivery without status'
 | 
			
		||||
    it_behaves_like 'delivery to non functional user'
 | 
			
		||||
    it_behaves_like 'delivery without status'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'reblog' do
 | 
			
		||||
@@ -95,7 +95,7 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
    let(:notification) { Notification.create!(account: receiver.account, activity: reblog) }
 | 
			
		||||
    let(:mail) { prepared_mailer_for(own_status.account).reblog }
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject', 'notification_mailer.reblog.subject', name: 'bob'
 | 
			
		||||
    it_behaves_like 'localized subject', 'notification_mailer.reblog.subject', name: 'bob'
 | 
			
		||||
 | 
			
		||||
    it 'renders the email' do
 | 
			
		||||
      expect(mail)
 | 
			
		||||
@@ -107,8 +107,8 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
        .and have_standard_headers('reblog').for(receiver)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to non functional user'
 | 
			
		||||
    include_examples 'delivery without status'
 | 
			
		||||
    it_behaves_like 'delivery to non functional user'
 | 
			
		||||
    it_behaves_like 'delivery without status'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'follow_request' do
 | 
			
		||||
@@ -116,7 +116,7 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
    let(:notification) { Notification.create!(account: receiver.account, activity: follow_request) }
 | 
			
		||||
    let(:mail) { prepared_mailer_for(receiver.account).follow_request }
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject', 'notification_mailer.follow_request.subject', name: 'bob'
 | 
			
		||||
    it_behaves_like 'localized subject', 'notification_mailer.follow_request.subject', name: 'bob'
 | 
			
		||||
 | 
			
		||||
    it 'renders the email' do
 | 
			
		||||
      expect(mail)
 | 
			
		||||
@@ -126,7 +126,7 @@ RSpec.describe NotificationMailer do
 | 
			
		||||
        .and have_standard_headers('follow_request').for(receiver)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to non functional user'
 | 
			
		||||
    it_behaves_like 'delivery to non functional user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  private
 | 
			
		||||
 
 | 
			
		||||
@@ -29,10 +29,10 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(Rails.configuration.x.local_domain))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'devise.mailer.confirmation_instructions.subject',
 | 
			
		||||
                    instance: Rails.configuration.x.local_domain
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#reconfirmation_instructions' do
 | 
			
		||||
@@ -48,10 +48,10 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(Rails.configuration.x.local_domain))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'devise.mailer.confirmation_instructions.subject',
 | 
			
		||||
                    instance: Rails.configuration.x.local_domain
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#reset_password_instructions' do
 | 
			
		||||
@@ -66,9 +66,9 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text('spec'))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'devise.mailer.reset_password_instructions.subject'
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#password_change' do
 | 
			
		||||
@@ -82,9 +82,9 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.password_change.title')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'devise.mailer.password_change.subject'
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#email_changed' do
 | 
			
		||||
@@ -98,9 +98,9 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.email_changed.title')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'devise.mailer.email_changed.subject'
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#warning' do
 | 
			
		||||
@@ -129,9 +129,9 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.webauthn_credential.deleted.title')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'devise.mailer.webauthn_credential.deleted.subject'
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#suspicious_sign_in' do
 | 
			
		||||
@@ -148,7 +148,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('user_mailer.suspicious_sign_in.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'user_mailer.suspicious_sign_in.subject'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -166,7 +166,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('user_mailer.failed_2fa.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'localized subject',
 | 
			
		||||
    it_behaves_like 'localized subject',
 | 
			
		||||
                    'user_mailer.failed_2fa.subject'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -204,7 +204,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.two_factor_enabled.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#two_factor_disabled' do
 | 
			
		||||
@@ -217,7 +217,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.two_factor_disabled.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#webauthn_enabled' do
 | 
			
		||||
@@ -230,7 +230,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.webauthn_enabled.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#webauthn_disabled' do
 | 
			
		||||
@@ -243,7 +243,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.webauthn_disabled.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#two_factor_recovery_codes_changed' do
 | 
			
		||||
@@ -256,7 +256,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.two_factor_recovery_codes_changed.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#webauthn_credential_added' do
 | 
			
		||||
@@ -270,7 +270,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('devise.mailer.webauthn_credential.added.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#welcome' do
 | 
			
		||||
@@ -289,7 +289,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('user_mailer.welcome.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#backup_ready' do
 | 
			
		||||
@@ -303,7 +303,7 @@ RSpec.describe UserMailer do
 | 
			
		||||
        .and(have_body_text(I18n.t('user_mailer.backup_ready.explanation')))
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'delivery to memorialized user'
 | 
			
		||||
    it_behaves_like 'delivery to memorialized user'
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#terms_of_service_changed' do
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,8 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe Account do
 | 
			
		||||
  include_examples 'Account::Search'
 | 
			
		||||
  include_examples 'Reviewable'
 | 
			
		||||
  it_behaves_like 'Account::Search'
 | 
			
		||||
  it_behaves_like 'Reviewable'
 | 
			
		||||
 | 
			
		||||
  context 'with an account record' do
 | 
			
		||||
    subject { Fabricate(:account) }
 | 
			
		||||
@@ -806,8 +806,8 @@ RSpec.describe Account do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  include_examples 'AccountAvatar', :account
 | 
			
		||||
  include_examples 'AccountHeader', :account
 | 
			
		||||
  it_behaves_like 'AccountAvatar', :account
 | 
			
		||||
  it_behaves_like 'AccountHeader', :account
 | 
			
		||||
 | 
			
		||||
  describe '#increment_count!' do
 | 
			
		||||
    subject { Fabricate(:account) }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe CustomFilter do
 | 
			
		||||
  include_examples 'Expireable'
 | 
			
		||||
  it_behaves_like 'Expireable'
 | 
			
		||||
 | 
			
		||||
  describe 'Validations' do
 | 
			
		||||
    it { is_expected.to validate_presence_of(:title) }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe Invite do
 | 
			
		||||
  include_examples 'Expireable'
 | 
			
		||||
  it_behaves_like 'Expireable'
 | 
			
		||||
 | 
			
		||||
  describe 'Associations' do
 | 
			
		||||
    it { is_expected.to belong_to(:user).inverse_of(:invites) }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe IpBlock do
 | 
			
		||||
  include_examples 'Expireable'
 | 
			
		||||
  it_behaves_like 'Expireable'
 | 
			
		||||
 | 
			
		||||
  describe 'Validations' do
 | 
			
		||||
    subject { Fabricate.build :ip_block }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe LoginActivity do
 | 
			
		||||
  include_examples 'BrowserDetection'
 | 
			
		||||
  it_behaves_like 'BrowserDetection'
 | 
			
		||||
 | 
			
		||||
  describe 'Associations' do
 | 
			
		||||
    it { is_expected.to belong_to(:user).required }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe Mute do
 | 
			
		||||
  include_examples 'Expireable'
 | 
			
		||||
  it_behaves_like 'Expireable'
 | 
			
		||||
 | 
			
		||||
  describe 'Associations' do
 | 
			
		||||
    it { is_expected.to belong_to(:account).required }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe Poll do
 | 
			
		||||
  include_examples 'Expireable'
 | 
			
		||||
  it_behaves_like 'Expireable'
 | 
			
		||||
 | 
			
		||||
  describe '#reset_votes!' do
 | 
			
		||||
    let(:poll) { Fabricate :poll, cached_tallies: [2, 3], votes_count: 5, voters_count: 5 }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe PreviewCardProvider do
 | 
			
		||||
  include_examples 'Reviewable'
 | 
			
		||||
  it_behaves_like 'Reviewable'
 | 
			
		||||
 | 
			
		||||
  describe 'scopes' do
 | 
			
		||||
    let(:trendable_and_reviewed) { Fabricate(:preview_card_provider, trendable: true, reviewed_at: 5.days.ago) }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe PreviewCardTrend do
 | 
			
		||||
  include_examples 'RankedTrend'
 | 
			
		||||
  it_behaves_like 'RankedTrend'
 | 
			
		||||
 | 
			
		||||
  describe 'Associations' do
 | 
			
		||||
    it { is_expected.to belong_to(:preview_card).required }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe SessionActivation do
 | 
			
		||||
  include_examples 'BrowserDetection'
 | 
			
		||||
  it_behaves_like 'BrowserDetection'
 | 
			
		||||
 | 
			
		||||
  describe '.active?' do
 | 
			
		||||
    subject { described_class.active?(id) }
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ RSpec.describe Status do
 | 
			
		||||
  let(:bob)   { Fabricate(:account, username: 'bob') }
 | 
			
		||||
  let(:other) { Fabricate(:status, account: bob, text: 'Skulls for the skull god! The enemy\'s gates are sideways!') }
 | 
			
		||||
 | 
			
		||||
  include_examples 'Status::Visibility'
 | 
			
		||||
  it_behaves_like 'Status::Visibility'
 | 
			
		||||
 | 
			
		||||
  describe '#local?' do
 | 
			
		||||
    it 'returns true when no remote URI is set' do
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe StatusTrend do
 | 
			
		||||
  include_examples 'RankedTrend'
 | 
			
		||||
  it_behaves_like 'RankedTrend'
 | 
			
		||||
 | 
			
		||||
  describe 'Associations' do
 | 
			
		||||
    it { is_expected.to belong_to(:account).required }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe Tag do
 | 
			
		||||
  include_examples 'Reviewable'
 | 
			
		||||
  it_behaves_like 'Reviewable'
 | 
			
		||||
 | 
			
		||||
  describe 'Validations' do
 | 
			
		||||
    describe 'name' do
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe TagTrend do
 | 
			
		||||
  include_examples 'RankedTrend'
 | 
			
		||||
  it_behaves_like 'RankedTrend'
 | 
			
		||||
 | 
			
		||||
  describe 'Associations' do
 | 
			
		||||
    it { is_expected.to belong_to(:tag).required }
 | 
			
		||||
 
 | 
			
		||||
@@ -25,10 +25,10 @@ RSpec.describe Admin::Fasp::ProviderPolicy, type: :policy do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  permissions :index?, :create? do
 | 
			
		||||
    include_examples 'admin only', Fasp::Provider
 | 
			
		||||
    it_behaves_like 'admin only', Fasp::Provider
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  permissions :show?, :create?, :update?, :destroy? do
 | 
			
		||||
    include_examples 'admin only', :fasp_provider
 | 
			
		||||
    it_behaves_like 'admin only', :fasp_provider
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ RSpec.describe 'Managing OAuth Tokens' do
 | 
			
		||||
        access_grant.plaintext_token
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      shared_examples 'returns originally requested scopes' do
 | 
			
		||||
      shared_examples 'original scope request preservation' do
 | 
			
		||||
        it 'returns all scopes requested for the given code' do
 | 
			
		||||
          subject
 | 
			
		||||
 | 
			
		||||
@@ -41,26 +41,26 @@ RSpec.describe 'Managing OAuth Tokens' do
 | 
			
		||||
      context 'with no scopes specified' do
 | 
			
		||||
        let(:scope) { nil }
 | 
			
		||||
 | 
			
		||||
        include_examples 'returns originally requested scopes'
 | 
			
		||||
        it_behaves_like 'original scope request preservation'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'with scopes specified' do
 | 
			
		||||
        context 'when the scopes were requested for this code' do
 | 
			
		||||
          let(:scope) { 'write' }
 | 
			
		||||
 | 
			
		||||
          include_examples 'returns originally requested scopes'
 | 
			
		||||
          it_behaves_like 'original scope request preservation'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        context 'when the scope was not requested for the code' do
 | 
			
		||||
          let(:scope) { 'follow' }
 | 
			
		||||
 | 
			
		||||
          include_examples 'returns originally requested scopes'
 | 
			
		||||
          it_behaves_like 'original scope request preservation'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        context 'when the scope does not belong to the application' do
 | 
			
		||||
          let(:scope) { 'push' }
 | 
			
		||||
 | 
			
		||||
          include_examples 'returns originally requested scopes'
 | 
			
		||||
          it_behaves_like 'original scope request preservation'
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
@@ -130,14 +130,14 @@ RSpec.describe 'OmniAuth callbacks' do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#openid_connect', if: ENV['OIDC_ENABLED'] == 'true' && ENV['OIDC_SCOPE'].present? do
 | 
			
		||||
    include_examples 'omniauth provider callbacks', :openid_connect
 | 
			
		||||
    it_behaves_like 'omniauth provider callbacks', :openid_connect
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#cas', if: ENV['CAS_ENABLED'] == 'true' do
 | 
			
		||||
    include_examples 'omniauth provider callbacks', :cas
 | 
			
		||||
    it_behaves_like 'omniauth provider callbacks', :cas
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#saml', if: ENV['SAML_ENABLED'] == 'true' do
 | 
			
		||||
    include_examples 'omniauth provider callbacks', :saml
 | 
			
		||||
    it_behaves_like 'omniauth provider callbacks', :saml
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ RSpec.describe ActivityPub::FetchRemoteAccountService do
 | 
			
		||||
        expect(account.domain).to eq 'example.com'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'sets profile data'
 | 
			
		||||
      it_behaves_like 'sets profile data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when WebFinger presents different domain than URI' do
 | 
			
		||||
@@ -91,7 +91,7 @@ RSpec.describe ActivityPub::FetchRemoteAccountService do
 | 
			
		||||
        expect(account.domain).to eq 'iscool.af'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'sets profile data'
 | 
			
		||||
      it_behaves_like 'sets profile data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when WebFinger returns a different URI' do
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ RSpec.describe ActivityPub::FetchRemoteActorService do
 | 
			
		||||
        expect(account.domain).to eq 'example.com'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'sets profile data'
 | 
			
		||||
      it_behaves_like 'sets profile data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when WebFinger presents different domain than URI' do
 | 
			
		||||
@@ -91,7 +91,7 @@ RSpec.describe ActivityPub::FetchRemoteActorService do
 | 
			
		||||
        expect(account.domain).to eq 'iscool.af'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'sets profile data'
 | 
			
		||||
      it_behaves_like 'sets profile data'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when WebFinger returns a different URI' do
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ RSpec.describe BulkImportRowService do
 | 
			
		||||
            account.follow!(target_account)
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          include_examples 'row import success and list addition'
 | 
			
		||||
          it_behaves_like 'row import success and list addition'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        context 'when the user already requested to follow the target account' do
 | 
			
		||||
@@ -123,17 +123,17 @@ RSpec.describe BulkImportRowService do
 | 
			
		||||
            account.request_follow!(target_account)
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          include_examples 'row import success and list addition'
 | 
			
		||||
          it_behaves_like 'row import success and list addition'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        context 'when the target account is neither followed nor requested' do
 | 
			
		||||
          include_examples 'row import success and list addition'
 | 
			
		||||
          it_behaves_like 'row import success and list addition'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        context 'when the target account is the user themself' do
 | 
			
		||||
          let(:target_account) { account }
 | 
			
		||||
 | 
			
		||||
          include_examples 'row import success and list addition'
 | 
			
		||||
          it_behaves_like 'row import success and list addition'
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def add_target_account_to_list
 | 
			
		||||
@@ -153,7 +153,7 @@ RSpec.describe BulkImportRowService do
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'when the list does not exist yet' do
 | 
			
		||||
        include_examples 'common behavior'
 | 
			
		||||
        it_behaves_like 'common behavior'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'when the list exists' do
 | 
			
		||||
@@ -161,7 +161,7 @@ RSpec.describe BulkImportRowService do
 | 
			
		||||
          Fabricate(:list, account: account, title: list_name)
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        include_examples 'common behavior'
 | 
			
		||||
        it_behaves_like 'common behavior'
 | 
			
		||||
 | 
			
		||||
        it 'does not create a new list' do
 | 
			
		||||
          account.follow!(target_account)
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ RSpec.describe DeleteAccountService do
 | 
			
		||||
    let!(:remote_alice) { Fabricate(:account, inbox_url: 'https://alice.com/inbox', domain: 'alice.com', protocol: :activitypub) }
 | 
			
		||||
    let!(:remote_bob) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', domain: 'bob.com', protocol: :activitypub) }
 | 
			
		||||
 | 
			
		||||
    include_examples 'common behavior' do
 | 
			
		||||
    it_behaves_like 'common behavior' do
 | 
			
		||||
      let(:account) { Fabricate(:account) }
 | 
			
		||||
      let(:local_follower) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
@@ -88,7 +88,7 @@ RSpec.describe DeleteAccountService do
 | 
			
		||||
      stub_request(:post, account.inbox_url).to_return(status: 201)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'common behavior' do
 | 
			
		||||
    it_behaves_like 'common behavior' do
 | 
			
		||||
      let(:account) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') }
 | 
			
		||||
      let(:local_follower) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ RSpec.describe SuspendAccountService do
 | 
			
		||||
      json['type'] == 'Update' && json['actor'] == actor_id && json['object']['id'] == actor_id && json['object']['suspended']
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'common behavior' do
 | 
			
		||||
    it_behaves_like 'common behavior' do
 | 
			
		||||
      let!(:account)         { Fabricate(:account) }
 | 
			
		||||
      let!(:remote_follower) { Fabricate(:account, uri: 'https://alice.com', inbox_url: 'https://alice.com/inbox', protocol: :activitypub, domain: 'alice.com') }
 | 
			
		||||
      let!(:remote_reporter) { Fabricate(:account, uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') }
 | 
			
		||||
@@ -72,7 +72,7 @@ RSpec.describe SuspendAccountService do
 | 
			
		||||
      json['type'] == 'Reject' && json['actor'] == ActivityPub::TagManager.instance.uri_for(followee) && json['object']['actor'] == account.uri
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'common behavior' do
 | 
			
		||||
    it_behaves_like 'common behavior' do
 | 
			
		||||
      let!(:account)        { Fabricate(:account, domain: 'bob.com', uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub) }
 | 
			
		||||
      let!(:local_followee) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe UnsuspendAccountService do
 | 
			
		||||
  shared_context 'with common context' do
 | 
			
		||||
  shared_context 'when account is unsuspended' do
 | 
			
		||||
    subject { described_class.new.call(account) }
 | 
			
		||||
 | 
			
		||||
    let!(:local_follower) { Fabricate(:user, current_sign_in_at: 1.hour.ago).account }
 | 
			
		||||
@@ -31,12 +31,13 @@ RSpec.describe UnsuspendAccountService do
 | 
			
		||||
      stub_request(:post, 'https://bob.com/inbox').to_return(status: 201)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    let!(:account) { Fabricate(:account) }
 | 
			
		||||
 | 
			
		||||
    it 'does not change the “suspended” flag' do
 | 
			
		||||
      expect { subject }.to_not change(account, :suspended?)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    include_examples 'with common context' do
 | 
			
		||||
      let!(:account)         { Fabricate(:account) }
 | 
			
		||||
    include_context 'when account is unsuspended' do
 | 
			
		||||
      let!(:remote_follower) { Fabricate(:account, uri: 'https://alice.com', inbox_url: 'https://alice.com/inbox', protocol: :activitypub, domain: 'alice.com') }
 | 
			
		||||
      let!(:remote_reporter) { Fabricate(:account, uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') }
 | 
			
		||||
 | 
			
		||||
@@ -65,7 +66,7 @@ RSpec.describe UnsuspendAccountService do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'unsuspending a remote account' do
 | 
			
		||||
    include_examples 'with common context' do
 | 
			
		||||
    include_context 'when account is unsuspended' do
 | 
			
		||||
      let!(:account) { Fabricate(:account, domain: 'bob.com', uri: 'https://bob.com', inbox_url: 'https://bob.com/inbox', protocol: :activitypub) }
 | 
			
		||||
      let!(:resolve_account_service) { instance_double(ResolveAccountService) }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,95 +8,82 @@ RSpec.describe Import::RowWorker do
 | 
			
		||||
  let(:row) { Fabricate(:bulk_import_row, bulk_import: import) }
 | 
			
		||||
 | 
			
		||||
  describe '#perform' do
 | 
			
		||||
    before do
 | 
			
		||||
      allow(BulkImportRowService).to receive(:new).and_return(service_double)
 | 
			
		||||
    before { allow(BulkImportRowService).to receive(:new).and_return(service_double) }
 | 
			
		||||
 | 
			
		||||
    shared_context 'when service succeeds' do
 | 
			
		||||
      let(:service_double) { instance_double(BulkImportRowService, call: true) }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    shared_context 'when service fails' do
 | 
			
		||||
      let(:service_double) { instance_double(BulkImportRowService, call: false) }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    shared_context 'when service errors' do
 | 
			
		||||
      let(:service_double) { instance_double(BulkImportRowService) }
 | 
			
		||||
      before { allow(service_double).to receive(:call).and_raise('dummy error') }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    shared_examples 'clean failure' do
 | 
			
		||||
      let(:service_double) { instance_double(BulkImportRowService, call: false) }
 | 
			
		||||
 | 
			
		||||
      it 'calls BulkImportRowService' do
 | 
			
		||||
        subject.perform(row.id)
 | 
			
		||||
        expect(service_double).to have_received(:call).with(row)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'increases the number of processed items' do
 | 
			
		||||
        expect { subject.perform(row.id) }.to(change { import.reload.processed_items }.by(+1))
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'does not increase the number of imported items' do
 | 
			
		||||
        expect { subject.perform(row.id) }.to_not(change { import.reload.imported_items })
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'does not delete the row' do
 | 
			
		||||
        subject.perform(row.id)
 | 
			
		||||
        expect(BulkImportRow.exists?(row.id)).to be true
 | 
			
		||||
      it 'calls service, increases processed items, preserves imported items, and keeps row' do
 | 
			
		||||
        expect { subject.perform(row.id) }
 | 
			
		||||
          .to change { import.reload.processed_items }.by(+1)
 | 
			
		||||
          .and not_change { import.reload.imported_items }
 | 
			
		||||
          .and(not_change { BulkImportRow.exists?(row.id) }.from(true))
 | 
			
		||||
        expect(service_double)
 | 
			
		||||
          .to have_received(:call).with(row)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    shared_examples 'unclean failure' do
 | 
			
		||||
      let(:service_double) { instance_double(BulkImportRowService) }
 | 
			
		||||
 | 
			
		||||
      before do
 | 
			
		||||
        allow(service_double).to receive(:call) do
 | 
			
		||||
          raise 'dummy error'
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'raises an error and does not change processed items count' do
 | 
			
		||||
        expect { subject.perform(row.id) }.to raise_error(StandardError, 'dummy error').and(not_change { import.reload.processed_items })
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'does not delete the row' do
 | 
			
		||||
        expect { subject.perform(row.id) }.to raise_error(StandardError, 'dummy error').and(not_change { BulkImportRow.exists?(row.id) })
 | 
			
		||||
      it 'raises an error, preserves processed items, and keeps row' do
 | 
			
		||||
        expect { subject.perform(row.id) }
 | 
			
		||||
          .to raise_error(StandardError, 'dummy error')
 | 
			
		||||
          .and(not_change { import.reload.processed_items })
 | 
			
		||||
          .and(not_change { BulkImportRow.exists?(row.id) }.from(true))
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    shared_examples 'clean success' do
 | 
			
		||||
      let(:service_double) { instance_double(BulkImportRowService, call: true) }
 | 
			
		||||
 | 
			
		||||
      it 'calls BulkImportRowService' do
 | 
			
		||||
        subject.perform(row.id)
 | 
			
		||||
      it 'calls service, increases processed items, increases imported items, and deletes row' do
 | 
			
		||||
        expect { subject.perform(row.id) }
 | 
			
		||||
          .to change { import.reload.processed_items }.by(+1)
 | 
			
		||||
          .and change { import.reload.imported_items }.by(+1)
 | 
			
		||||
          .and(change { BulkImportRow.exists?(row.id) }.from(true).to(false))
 | 
			
		||||
        expect(service_double).to have_received(:call).with(row)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'increases the number of processed items' do
 | 
			
		||||
        expect { subject.perform(row.id) }.to(change { import.reload.processed_items }.by(+1))
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'increases the number of imported items' do
 | 
			
		||||
        expect { subject.perform(row.id) }.to(change { import.reload.imported_items }.by(+1))
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'deletes the row' do
 | 
			
		||||
        expect { subject.perform(row.id) }.to change { BulkImportRow.exists?(row.id) }.from(true).to(false)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when there are multiple rows to process' do
 | 
			
		||||
      let(:import) { Fabricate(:bulk_import, total_items: 2, processed_items: 0, imported_items: 0, state: :in_progress) }
 | 
			
		||||
 | 
			
		||||
      context 'with a clean failure' do
 | 
			
		||||
        include_examples 'clean failure'
 | 
			
		||||
        include_context 'when service fails'
 | 
			
		||||
        it_behaves_like 'clean failure'
 | 
			
		||||
 | 
			
		||||
        it 'does not mark the import as finished' do
 | 
			
		||||
          expect { subject.perform(row.id) }.to_not(change { import.reload.state.to_sym })
 | 
			
		||||
          expect { subject.perform(row.id) }
 | 
			
		||||
            .to_not(change { import.reload.state.to_sym })
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'with an unclean failure' do
 | 
			
		||||
        include_examples 'unclean failure'
 | 
			
		||||
        include_context 'when service errors'
 | 
			
		||||
        it_behaves_like 'unclean failure'
 | 
			
		||||
 | 
			
		||||
        it 'does not mark the import as finished' do
 | 
			
		||||
          expect { subject.perform(row.id) }.to raise_error(StandardError).and(not_change { import.reload.state.to_sym })
 | 
			
		||||
          expect { subject.perform(row.id) }
 | 
			
		||||
            .to raise_error(StandardError)
 | 
			
		||||
            .and(not_change { import.reload.state.to_sym })
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'with a clean success' do
 | 
			
		||||
        include_examples 'clean success'
 | 
			
		||||
        include_context 'when service succeeds'
 | 
			
		||||
        it_behaves_like 'clean success'
 | 
			
		||||
 | 
			
		||||
        it 'does not mark the import as finished' do
 | 
			
		||||
          expect { subject.perform(row.id) }.to_not(change { import.reload.state.to_sym })
 | 
			
		||||
          expect { subject.perform(row.id) }
 | 
			
		||||
            .to_not(change { import.reload.state.to_sym })
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
@@ -105,21 +92,28 @@ RSpec.describe Import::RowWorker do
 | 
			
		||||
      let(:import) { Fabricate(:bulk_import, total_items: 2, processed_items: 1, imported_items: 0, state: :in_progress) }
 | 
			
		||||
 | 
			
		||||
      context 'with a clean failure' do
 | 
			
		||||
        include_examples 'clean failure'
 | 
			
		||||
        include_context 'when service fails'
 | 
			
		||||
        it_behaves_like 'clean failure'
 | 
			
		||||
 | 
			
		||||
        it 'marks the import as finished' do
 | 
			
		||||
          expect { subject.perform(row.id) }.to change { import.reload.state.to_sym }.from(:in_progress).to(:finished)
 | 
			
		||||
          expect { subject.perform(row.id) }
 | 
			
		||||
            .to change { import.reload.state.to_sym }.from(:in_progress).to(:finished)
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'with an unclean failure' do
 | 
			
		||||
        # NOTE: sidekiq retry logic may be a bit too difficult to test, so leaving this blind spot for now
 | 
			
		||||
        include_context 'when service errors'
 | 
			
		||||
        it_behaves_like 'unclean failure'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context 'with a clean success' do
 | 
			
		||||
        include_examples 'clean success'
 | 
			
		||||
        include_context 'when service succeeds'
 | 
			
		||||
        it_behaves_like 'clean success'
 | 
			
		||||
 | 
			
		||||
        it 'marks the import as finished' do
 | 
			
		||||
          expect { subject.perform(row.id) }.to change { import.reload.state.to_sym }.from(:in_progress).to(:finished)
 | 
			
		||||
          expect { subject.perform(row.id) }
 | 
			
		||||
            .to change { import.reload.state.to_sym }.from(:in_progress).to(:finished)
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
@@ -113,27 +113,27 @@ RSpec.describe MoveWorker do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  shared_examples 'common tests' do
 | 
			
		||||
    include_examples 'user note handling'
 | 
			
		||||
    include_examples 'block and mute handling'
 | 
			
		||||
    include_examples 'followers count handling'
 | 
			
		||||
    include_examples 'lists handling'
 | 
			
		||||
    it_behaves_like 'user note handling'
 | 
			
		||||
    it_behaves_like 'block and mute handling'
 | 
			
		||||
    it_behaves_like 'followers count handling'
 | 
			
		||||
    it_behaves_like 'lists handling'
 | 
			
		||||
 | 
			
		||||
    context 'when a local user already follows both source and target' do
 | 
			
		||||
      before do
 | 
			
		||||
        local_follower.request_follow!(target_account)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'user note handling'
 | 
			
		||||
      include_examples 'block and mute handling'
 | 
			
		||||
      include_examples 'followers count handling'
 | 
			
		||||
      include_examples 'lists handling'
 | 
			
		||||
      it_behaves_like 'user note handling'
 | 
			
		||||
      it_behaves_like 'block and mute handling'
 | 
			
		||||
      it_behaves_like 'followers count handling'
 | 
			
		||||
      it_behaves_like 'lists handling'
 | 
			
		||||
 | 
			
		||||
      context 'when the local user already has the target in a list' do
 | 
			
		||||
        before do
 | 
			
		||||
          list.accounts << target_account
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        include_examples 'lists handling'
 | 
			
		||||
        it_behaves_like 'lists handling'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@@ -142,17 +142,17 @@ RSpec.describe MoveWorker do
 | 
			
		||||
        local_follower.follow!(target_account)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'user note handling'
 | 
			
		||||
      include_examples 'block and mute handling'
 | 
			
		||||
      include_examples 'followers count handling'
 | 
			
		||||
      include_examples 'lists handling'
 | 
			
		||||
      it_behaves_like 'user note handling'
 | 
			
		||||
      it_behaves_like 'block and mute handling'
 | 
			
		||||
      it_behaves_like 'followers count handling'
 | 
			
		||||
      it_behaves_like 'lists handling'
 | 
			
		||||
 | 
			
		||||
      context 'when the local user already has the target in a list' do
 | 
			
		||||
        before do
 | 
			
		||||
          list.accounts << target_account
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        include_examples 'lists handling'
 | 
			
		||||
        it_behaves_like 'lists handling'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
@@ -164,7 +164,7 @@ RSpec.describe MoveWorker do
 | 
			
		||||
        expect(UnfollowFollowWorker).to have_enqueued_sidekiq_job(local_follower.id, source_account.id, target_account.id, false)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'common tests'
 | 
			
		||||
      it_behaves_like 'common tests'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when target account is local' do
 | 
			
		||||
@@ -175,7 +175,7 @@ RSpec.describe MoveWorker do
 | 
			
		||||
        expect(UnfollowFollowWorker).to have_enqueued_sidekiq_job(local_follower.id, source_account.id, target_account.id, true)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'common tests'
 | 
			
		||||
      it_behaves_like 'common tests'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when both target and source accounts are local' do
 | 
			
		||||
@@ -187,7 +187,7 @@ RSpec.describe MoveWorker do
 | 
			
		||||
        expect(local_follower.following?(target_account)).to be true
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      include_examples 'common tests'
 | 
			
		||||
      it_behaves_like 'common tests'
 | 
			
		||||
 | 
			
		||||
      it 'does not allow the moved account to follow themselves' do
 | 
			
		||||
        source_account.follow!(target_account)
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,7 @@ RSpec.describe Scheduler::AccountsStatusesCleanupScheduler do
 | 
			
		||||
 | 
			
		||||
    context 'when the budget is lower than the number of toots to delete' do
 | 
			
		||||
      it 'deletes the appropriate statuses' do
 | 
			
		||||
        expect(Status.count).to be > (subject.compute_budget) # Data check
 | 
			
		||||
        expect(Status.count).to be > subject.compute_budget # Data check
 | 
			
		||||
 | 
			
		||||
        expect { subject.perform }
 | 
			
		||||
          .to change(Status, :count).by(-subject.compute_budget) # Cleanable statuses
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user