]> cat aescling's git repositories - mastodon.git/commitdiff
Add specs for ActivityPub::InboxesController (#9456)
authorysksn <bluewhale1982@gmail.com>
Fri, 7 Dec 2018 15:40:01 +0000 (00:40 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 7 Dec 2018 15:40:01 +0000 (16:40 +0100)
spec/controllers/activitypub/inboxes_controller_spec.rb

index 5c12fea7df8457451c4742d62b6231c7f1c28ad4..4055d93424c2682b983632c31e895ab99152ff8d 100644 (file)
@@ -1,7 +1,29 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe ActivityPub::InboxesController, type: :controller do
   describe 'POST #create' do
-    pending
+    context 'if signed_request_account' do
+      it 'returns 202' do
+        allow(controller).to receive(:signed_request_account) do
+          Fabricate(:account)
+        end
+
+        post :create
+        expect(response).to have_http_status(202)
+      end
+    end
+
+    context 'not signed_request_account' do
+      it 'returns 401' do
+        allow(controller).to receive(:signed_request_account) do
+          false
+        end
+
+        post :create
+        expect(response).to have_http_status(401)
+      end
+    end
   end
 end