diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index bbd528a0a39..f241d261b1b 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -215,8 +215,13 @@ RSpec.describe Admin::AccountsController do it 'succeeds in rejecting account and logs action' do expect(subject).to redirect_to admin_accounts_path(status: 'pending') - expect { account.reload } - .to raise_error(ActiveRecord::RecordNotFound) + expect(latest_admin_action_log) + .to be_present + .and have_attributes( + action: eq(:reject), + account_id: eq(current_user.account_id), + target_id: eq(account.user.id) + ) end end diff --git a/spec/requests/api/v1/admin/accounts_spec.rb b/spec/requests/api/v1/admin/accounts_spec.rb index 0e7bd0dba13..1615581f0ea 100644 --- a/spec/requests/api/v1/admin/accounts_spec.rb +++ b/spec/requests/api/v1/admin/accounts_spec.rb @@ -199,6 +199,18 @@ RSpec.describe 'Accounts' do expect(response).to have_http_status(200) expect(User.where(id: account.user.id)).to_not exist end + + it 'logs action', :aggregate_failures do + subject + + expect(latest_admin_action_log) + .to be_present + .and have_attributes( + action: eq(:reject), + account_id: eq(user.account_id), + target_id: eq(account.user.id) + ) + end end context 'when account is already approved' do