From 3835f8286aea0f1b51fc8fdff3c8d7c60a8855f6 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 27 May 2024 09:34:45 -0400 Subject: [PATCH] Restore action log specs --- spec/controllers/admin/accounts_controller_spec.rb | 9 +++++++-- spec/requests/api/v1/admin/accounts_spec.rb | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) 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