about summary refs log tree commit diff
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2018-12-08 00:40:01 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-12-07 16:40:01 +0100
commitd3547fa00580a03d1687316d56c32f407c0d9fe6 (patch)
tree794e8fcbafcc68344ab25fd289c9bcd8d3fd1846
parent88b3eed16f9ecabfc81b81d1af3a2e10b0f68517 (diff)
Add specs for ActivityPub::InboxesController (#9456)
-rw-r--r--spec/controllers/activitypub/inboxes_controller_spec.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/controllers/activitypub/inboxes_controller_spec.rb b/spec/controllers/activitypub/inboxes_controller_spec.rb
index 5c12fea7d..4055d9342 100644
--- a/spec/controllers/activitypub/inboxes_controller_spec.rb
+++ b/spec/controllers/activitypub/inboxes_controller_spec.rb
@@ -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