0
0
Fork 0

Use Sidekiq fake! instead of inline! in specs (#25369)

This commit is contained in:
Matt Jankowski 2024-01-10 06:06:58 -05:00 committed by GitHub
parent ea1c0feb86
commit 00341c70ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 66 additions and 76 deletions

View file

@ -44,7 +44,7 @@ RSpec.describe Admin::Disputes::AppealsController do
expect(response).to redirect_to(disputes_strike_path(appeal.strike))
end
it 'notifies target account about approved appeal' do
it 'notifies target account about approved appeal', :sidekiq_inline do
expect(UserMailer.deliveries.size).to eq(1)
expect(UserMailer.deliveries.first.to.first).to eq(target_account.user.email)
expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.appeal_approved.subject', date: I18n.l(appeal.created_at)))
@ -62,7 +62,7 @@ RSpec.describe Admin::Disputes::AppealsController do
expect(response).to redirect_to(disputes_strike_path(appeal.strike))
end
it 'notifies target account about rejected appeal' do
it 'notifies target account about rejected appeal', :sidekiq_inline do
expect(UserMailer.deliveries.size).to eq(1)
expect(UserMailer.deliveries.first.to.first).to eq(target_account.user.email)
expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.appeal_rejected.subject', date: I18n.l(appeal.created_at)))

View file

@ -176,7 +176,7 @@ RSpec.describe Admin::DomainBlocksController do
end
end
describe 'PUT #update' do
describe 'PUT #update', :sidekiq_inline do
subject do
post :update, params: { :id => domain_block.id, :domain_block => { domain: 'example.com', severity: new_severity }, 'confirm' => '' }
end

View file

@ -11,7 +11,7 @@ describe Admin::ResetsController do
sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')), scope: :user
end
describe 'POST #create' do
describe 'POST #create', :sidekiq_inline do
it 'redirects to admin accounts page' do
expect do
post :create, params: { account_id: account.id }

View file

@ -13,7 +13,7 @@ RSpec.describe Api::V1::ConversationsController do
allow(controller).to receive(:doorkeeper_token) { token }
end
describe 'GET #index' do
describe 'GET #index', :sidekiq_inline do
let(:scopes) { 'read:statuses' }
before do

View file

@ -9,7 +9,7 @@ describe Api::V1::Statuses::ReblogsController do
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:statuses', application: app) }
context 'with an oauth token', :sidekiq_fake do
context 'with an oauth token' do
before do
allow(controller).to receive(:doorkeeper_token) { token }
end
@ -46,7 +46,7 @@ describe Api::V1::Statuses::ReblogsController do
end
end
describe 'POST #destroy' do
describe 'POST #destroy', :sidekiq_inline do
context 'with public status' do
let(:status) { Fabricate(:status, account: user.account) }

View file

@ -138,7 +138,7 @@ RSpec.describe Auth::SessionsController do
expect(controller.current_user).to eq user
end
it 'sends a suspicious sign-in mail' do
it 'sends a suspicious sign-in mail', :sidekiq_inline do
expect(UserMailer.deliveries.size).to eq(1)
expect(UserMailer.deliveries.first.to.first).to eq(user.email)
expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.suspicious_sign_in.subject'))

View file

@ -75,7 +75,7 @@ describe UserTrackingConcern do
expect(redis.ttl("account:#{user.account_id}:regeneration")).to be >= 0
end
it 'regenerates feed when sign in is older than two weeks' do
it 'regenerates feed when sign in is older than two weeks', :sidekiq_inline do
get :show
expect_updated_sign_in_at(user)

View file

@ -17,7 +17,7 @@ RSpec.describe Disputes::AppealsController do
post :create, params: { strike_id: strike.id, appeal: { text: 'Foo' } }
end
it 'notifies staff about new appeal' do
it 'notifies staff about new appeal', :sidekiq_inline do
expect(ActionMailer::Base.deliveries.first.to).to eq([admin.email])
end

View file

@ -50,7 +50,7 @@ describe Settings::DeletesController do
delete :destroy, params: { form_delete_confirmation: { password: 'petsmoldoggos' } }
end
it 'removes user record and redirects', :aggregate_failures do
it 'removes user record and redirects', :aggregate_failures, :sidekiq_inline do
expect(response).to redirect_to '/auth/sign_in'
expect(User.find_by(id: user.id)).to be_nil
expect(user.account.reload).to be_suspended

View file

@ -38,7 +38,7 @@ describe Settings::ExportsController do
expect(response).to redirect_to(settings_export_path)
end
it 'queues BackupWorker job by 1', :sidekiq_fake do
it 'queues BackupWorker job by 1' do
expect do
post :create
end.to change(BackupWorker.jobs, :size).by(1)