Merge commit '82e477b184b5666fff7fb55933dce22ca2925db8' into glitch-soc/merge-upstream

Conflicts:
- `db/migrate/20180831171112_create_bookmarks.rb`:
  Upstream ran a lint fix on this file, but this file is different in
  glitch-soc because the feature was added much earlier.
  Ran the lint fix on our own version of the file.
This commit is contained in:
Claire
2023-07-12 16:03:05 +02:00
458 changed files with 1117 additions and 853 deletions

View File

@ -166,10 +166,11 @@ RSpec.describe Admin::DomainBlocksController do
end
describe 'PUT #update' do
let!(:remote_account) { Fabricate(:account, domain: 'example.com') }
let(:subject) do
subject do
post :update, params: { :id => domain_block.id, :domain_block => { domain: 'example.com', severity: new_severity }, 'confirm' => '' }
end
let!(:remote_account) { Fabricate(:account, domain: 'example.com') }
let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', severity: original_severity) }
before do

View File

@ -88,10 +88,11 @@ describe Api::BaseController do
Mastodon::NotPermittedError => 403,
}.each do |error, code|
it "Handles error class of #{error}" do
expect(FakeService).to receive(:new).and_raise(error)
allow(FakeService).to receive(:new).and_raise(error)
get 'error'
expect(response).to have_http_status(code)
expect(FakeService).to have_received(:new)
end
end
end

View File

@ -16,7 +16,7 @@ RSpec.describe Api::V1::MediaController do
describe 'with paperclip errors' do
context 'when imagemagick cant identify the file type' do
it 'returns http 422' do
expect_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Errors::NotIdentifiedByImageMagickError)
allow_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Errors::NotIdentifiedByImageMagickError)
post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') }
expect(response).to have_http_status(422)
@ -25,7 +25,7 @@ RSpec.describe Api::V1::MediaController do
context 'when there is a generic error' do
it 'returns http 422' do
expect_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Error)
allow_any_instance_of(Account).to receive_message_chain(:media_attachments, :create!).and_raise(Paperclip::Error)
post :create, params: { file: fixture_file_upload('attachment.jpg', 'image/jpeg') }
expect(response).to have_http_status(500)

View File

@ -15,20 +15,22 @@ RSpec.describe Auth::RegistrationsController do
it 'redirects if it is in single user mode while it is open for registration' do
Fabricate(:account)
Setting.registrations_mode = 'open'
expect(Rails.configuration.x).to receive(:single_user_mode).and_return(true)
allow(Rails.configuration.x).to receive(:single_user_mode).and_return(true)
get path
expect(response).to redirect_to '/'
expect(Rails.configuration.x).to have_received(:single_user_mode)
end
it 'redirects if it is not open for registration while it is not in single user mode' do
Setting.registrations_mode = 'none'
expect(Rails.configuration.x).to receive(:single_user_mode).and_return(false)
allow(Rails.configuration.x).to receive(:single_user_mode).and_return(false)
get path
expect(response).to redirect_to '/'
expect(Rails.configuration.x).to have_received(:single_user_mode)
end
end

View File

@ -104,7 +104,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
post :create,
params: { form_two_factor_confirmation: { otp_attempt: '123456' } },
session: { challenge_passed_at: Time.now.utc, new_otp_secret: 'thisisasecretforthespecofnewview' }
end.to not_change { user.reload.otp_secret }
end.to(not_change { user.reload.otp_secret })
end
it 'renders the new view' do

View File

@ -63,7 +63,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController do
expect do
post :create, session: { challenge_passed_at: Time.now.utc }
end.to not_change { user.reload.otp_secret }
.and change { session[:new_otp_secret] }
.and(change { session[:new_otp_secret] })
expect(response).to redirect_to(new_settings_two_factor_authentication_confirmation_path)
end
@ -80,7 +80,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController do
expect do
post :create, session: { challenge_passed_at: Time.now.utc }
end.to not_change { user.reload.otp_secret }
.and change { session[:new_otp_secret] }
.and(change { session[:new_otp_secret] })
expect(response).to redirect_to(new_settings_two_factor_authentication_confirmation_path)
end