about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2018-02-08 13:00:45 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-02-08 05:00:45 +0100
commitcf32f7da5c5af7c86af3cab89d18cdbe7b35f4a2 (patch)
tree5d9291daf06aba7de041f0d079931b7795264d08 /spec/controllers
parent2bb393684baf5da1112923db7bcda920d606be78 (diff)
Fix response of signature_verification_failure_reason (#6441)
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/api/salmon_controller_spec.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/controllers/api/salmon_controller_spec.rb b/spec/controllers/api/salmon_controller_spec.rb
index 323d85b61..8af8b83a8 100644
--- a/spec/controllers/api/salmon_controller_spec.rb
+++ b/spec/controllers/api/salmon_controller_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe Api::SalmonController, type: :controller do
       end
     end
 
-    context 'with invalid post data' do
+    context 'with empty post data' do
       before do
         request.env['RAW_POST_DATA'] = ''
         post :update, params: { id: account.id }
@@ -50,5 +50,19 @@ RSpec.describe Api::SalmonController, type: :controller do
         expect(response).to have_http_status(400)
       end
     end
+
+    context 'with invalid post data' do
+      before do
+        service = double(call: false)
+        allow(VerifySalmonService).to receive(:new).and_return(service)
+
+        request.env['RAW_POST_DATA'] = File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
+        post :update, params: { id: account.id }
+      end
+
+      it 'returns http client error' do
+        expect(response).to have_http_status(401)
+      end
+    end
   end
 end