0
0
Fork 0

Add missing action logging to api/v1/admin/reports#update (#29044)

This commit is contained in:
Matt Jankowski 2024-02-06 06:34:11 -05:00 committed by GitHub
parent a31427a629
commit 4cf07ed78c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 5 deletions

View file

@ -151,7 +151,9 @@ RSpec.describe 'Reports' do
let(:params) { { category: 'spam' } }
it 'updates the report category', :aggregate_failures do
expect { subject }.to change { report.reload.category }.from('other').to('spam')
expect { subject }
.to change { report.reload.category }.from('other').to('spam')
.and create_an_action_log
expect(response).to have_http_status(200)
@ -184,7 +186,9 @@ RSpec.describe 'Reports' do
it_behaves_like 'forbidden for wrong role', ''
it 'marks report as resolved', :aggregate_failures do
expect { subject }.to change { report.reload.unresolved? }.from(true).to(false)
expect { subject }
.to change { report.reload.unresolved? }.from(true).to(false)
.and create_an_action_log
expect(response).to have_http_status(200)
end
end
@ -200,7 +204,9 @@ RSpec.describe 'Reports' do
it_behaves_like 'forbidden for wrong role', ''
it 'marks report as unresolved', :aggregate_failures do
expect { subject }.to change { report.reload.unresolved? }.from(false).to(true)
expect { subject }
.to change { report.reload.unresolved? }.from(false).to(true)
.and create_an_action_log
expect(response).to have_http_status(200)
end
end
@ -216,7 +222,9 @@ RSpec.describe 'Reports' do
it_behaves_like 'forbidden for wrong role', ''
it 'assigns report to the requesting user', :aggregate_failures do
expect { subject }.to change { report.reload.assigned_account_id }.from(nil).to(user.account.id)
expect { subject }
.to change { report.reload.assigned_account_id }.from(nil).to(user.account.id)
.and create_an_action_log
expect(response).to have_http_status(200)
end
end
@ -232,8 +240,16 @@ RSpec.describe 'Reports' do
it_behaves_like 'forbidden for wrong role', ''
it 'unassigns report from assignee', :aggregate_failures do
expect { subject }.to change { report.reload.assigned_account_id }.from(user.account.id).to(nil)
expect { subject }
.to change { report.reload.assigned_account_id }.from(user.account.id).to(nil)
.and create_an_action_log
expect(response).to have_http_status(200)
end
end
private
def create_an_action_log
change(Admin::ActionLog, :count).by(1)
end
end