|
|
|
@ -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
|
|
|
|
|