about summary refs log tree commit diff
path: root/spec/controllers/api/v1/reports_controller_spec.rb
diff options
context:
space:
mode:
authorbeatrix-bitrot <beatrix.bitrot@gmail.com>2017-06-27 20:46:13 +0000
committerbeatrix-bitrot <beatrix.bitrot@gmail.com>2017-06-27 20:46:13 +0000
commitddafde942ca53816c19b0ea0cb40bb1b46cf5668 (patch)
treec0ac2138fe994c4c2a15c23b47d4155f75148945 /spec/controllers/api/v1/reports_controller_spec.rb
parente6300de1421d28d173658e61601b9e016c3d0a6d (diff)
parentda42bfadb58888e3a18afd66395f0f3edc2fa622 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'spec/controllers/api/v1/reports_controller_spec.rb')
-rw-r--r--spec/controllers/api/v1/reports_controller_spec.rb13
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