Fix test
This commit is contained in:
parent
28a08ce478
commit
f24f83d9b0
2 changed files with 5 additions and 5 deletions
|
@ -8,7 +8,7 @@ class Settings::PrivacyExtraController < Settings::BaseController
|
||||||
def update
|
def update
|
||||||
if UpdateAccountService.new.call(@account, account_params.except(:settings))
|
if UpdateAccountService.new.call(@account, account_params.except(:settings))
|
||||||
current_user.update!(settings_attributes: account_params[:settings])
|
current_user.update!(settings_attributes: account_params[:settings])
|
||||||
ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
|
ActivityPub::UpdateDistributionWorker.perform_in(ActivityPub::UpdateDistributionWorker::DEBOUNCE_DELAY, @account.id)
|
||||||
redirect_to settings_privacy_extra_path, notice: I18n.t('generic.changes_saved_msg')
|
redirect_to settings_privacy_extra_path, notice: I18n.t('generic.changes_saved_msg')
|
||||||
else
|
else
|
||||||
render :show
|
render :show
|
||||||
|
|
|
@ -31,7 +31,7 @@ RSpec.describe Settings::PrivacyController do
|
||||||
describe 'PUT #update' do
|
describe 'PUT #update' do
|
||||||
context 'when update succeeds' do
|
context 'when update succeeds' do
|
||||||
before do
|
before do
|
||||||
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
|
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_in)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'updates the user profile' do
|
it 'updates the user profile' do
|
||||||
|
@ -44,14 +44,14 @@ RSpec.describe Settings::PrivacyController do
|
||||||
.to redirect_to(settings_privacy_path)
|
.to redirect_to(settings_privacy_path)
|
||||||
|
|
||||||
expect(ActivityPub::UpdateDistributionWorker)
|
expect(ActivityPub::UpdateDistributionWorker)
|
||||||
.to have_received(:perform_async).with(account.id)
|
.to have_received(:perform_in).with(ActivityPub::UpdateDistributionWorker::DEBOUNCE_DELAY, account.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when update fails' do
|
context 'when update fails' do
|
||||||
before do
|
before do
|
||||||
allow(UpdateAccountService).to receive(:new).and_return(failing_update_service)
|
allow(UpdateAccountService).to receive(:new).and_return(failing_update_service)
|
||||||
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
|
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_in)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'updates the user profile' do
|
it 'updates the user profile' do
|
||||||
|
@ -61,7 +61,7 @@ RSpec.describe Settings::PrivacyController do
|
||||||
.to render_template(:show)
|
.to render_template(:show)
|
||||||
|
|
||||||
expect(ActivityPub::UpdateDistributionWorker)
|
expect(ActivityPub::UpdateDistributionWorker)
|
||||||
.to_not have_received(:perform_async)
|
.to_not have_received(:perform_in)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue