about summary refs log tree commit diff
path: root/spec/controllers/api/salmon_controller_spec.rb
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-02-08 23:17:14 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-02-08 23:17:14 +0000
commit5ba2c300d8ab0e3adc58a380162b66abafbb3bb8 (patch)
treea3bb67479db79ca9777cf2d6c1b767ad0f0f53d2 /spec/controllers/api/salmon_controller_spec.rb
parent3405ea6dd9fde38ba1044933fec2ec7fa909ea8c (diff)
parent1167c6dbf8d5b8411d9924350b2b9735da6d9d26 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'spec/controllers/api/salmon_controller_spec.rb')
-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