|
|
|
@ -15,7 +15,6 @@ describe Admin::ReportNotesController do
|
|
|
|
|
let(:report) { Fabricate(:report, action_taken: action_taken, action_taken_by_account_id: account_id) }
|
|
|
|
|
|
|
|
|
|
context 'when parameter is valid' do
|
|
|
|
|
|
|
|
|
|
context 'when report is unsolved' do
|
|
|
|
|
let(:action_taken) { false }
|
|
|
|
|
let(:account_id) { nil }
|
|
|
|
@ -24,7 +23,7 @@ describe Admin::ReportNotesController do
|
|
|
|
|
let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } }
|
|
|
|
|
|
|
|
|
|
it 'creates a report note and resolves report' do
|
|
|
|
|
expect{ subject }.to change{ ReportNote.count }.by(1)
|
|
|
|
|
expect { subject }.to change { ReportNote.count }.by(1)
|
|
|
|
|
expect(report.reload).to be_action_taken
|
|
|
|
|
expect(subject).to redirect_to admin_reports_path
|
|
|
|
|
end
|
|
|
|
@ -34,7 +33,7 @@ describe Admin::ReportNotesController do
|
|
|
|
|
let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
|
|
|
|
|
|
|
|
|
|
it 'creates a report note and does not resolve report' do
|
|
|
|
|
expect{ subject }.to change{ ReportNote.count }.by(1)
|
|
|
|
|
expect { subject }.to change { ReportNote.count }.by(1)
|
|
|
|
|
expect(report.reload).not_to be_action_taken
|
|
|
|
|
expect(subject).to redirect_to admin_report_path(report)
|
|
|
|
|
end
|
|
|
|
@ -49,7 +48,7 @@ describe Admin::ReportNotesController do
|
|
|
|
|
let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } }
|
|
|
|
|
|
|
|
|
|
it 'creates a report note and unresolves report' do
|
|
|
|
|
expect{ subject }.to change{ ReportNote.count }.by(1)
|
|
|
|
|
expect { subject }.to change { ReportNote.count }.by(1)
|
|
|
|
|
expect(report.reload).not_to be_action_taken
|
|
|
|
|
expect(subject).to redirect_to admin_report_path(report)
|
|
|
|
|
end
|
|
|
|
@ -59,7 +58,7 @@ describe Admin::ReportNotesController do
|
|
|
|
|
let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
|
|
|
|
|
|
|
|
|
|
it 'creates a report note and does not unresolve report' do
|
|
|
|
|
expect{ subject }.to change{ ReportNote.count }.by(1)
|
|
|
|
|
expect { subject }.to change { ReportNote.count }.by(1)
|
|
|
|
|
expect(report.reload).to be_action_taken
|
|
|
|
|
expect(subject).to redirect_to admin_report_path(report)
|
|
|
|
|
end
|
|
|
|
@ -84,7 +83,7 @@ describe Admin::ReportNotesController do
|
|
|
|
|
let!(:report_note) { Fabricate(:report_note) }
|
|
|
|
|
|
|
|
|
|
it 'deletes note' do
|
|
|
|
|
expect{ subject }.to change{ ReportNote.count }.by(-1)
|
|
|
|
|
expect { subject }.to change { ReportNote.count }.by(-1)
|
|
|
|
|
expect(subject).to redirect_to admin_report_path(report_note.report)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|