diff options
Diffstat (limited to 'spec/controllers/api/v1')
-rw-r--r-- | spec/controllers/api/v1/reports_controller_spec.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/controllers/api/v1/reports_controller_spec.rb b/spec/controllers/api/v1/reports_controller_spec.rb index 3df6cdfe7..471ea4e0b 100644 --- a/spec/controllers/api/v1/reports_controller_spec.rb +++ b/spec/controllers/api/v1/reports_controller_spec.rb @@ -21,12 +21,21 @@ RSpec.describe Api::V1::ReportsController, type: :controller do end describe 'POST #create' do - it 'creates a report' do - status = Fabricate(:status) + let!(:status) { Fabricate(:status) } + let!(:admin) { Fabricate(:user, admin: true) } + + before do + allow(AdminMailer).to receive(:new_report).and_return(double('email', deliver_later: nil)) post :create, params: { status_ids: [status.id], account_id: status.account.id, comment: 'reasons' } + end + it 'creates a report' do expect(status.reload.account.targeted_reports).not_to be_empty expect(response).to have_http_status(:success) end + + it 'sends e-mails to admins' do + expect(AdminMailer).to have_received(:new_report).with(admin.account, Report) + end end end |