about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2018-12-11 05:39:25 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-12-10 21:39:25 +0100
commited24bb2c3ecf82521be0685f59ecdee77c6fff39 (patch)
treeead339c95532646913403030f1110e7496358bd7 /spec
parent6eae8f77afd60d40c62d4c2f7e5731607f6f6163 (diff)
Add specs for activitypub collections controller (#9484)
* Add specs for ActivityPub::CollectionsController#show

* Raise ActiveRecord::RecordNotFound

Raising ActiveRecord::NotFound raises NameError: uninitialized constant
ActiveRecord::NotFound.
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/activitypub/collections_controller_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/activitypub/collections_controller_spec.rb b/spec/controllers/activitypub/collections_controller_spec.rb
new file mode 100644
index 000000000..34114cc85
--- /dev/null
+++ b/spec/controllers/activitypub/collections_controller_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+RSpec.describe ActivityPub::CollectionsController, type: :controller do
+  describe 'POST #show' do
+    let(:account) { Fabricate(:account) }
+
+    context 'id is "featured"' do
+      it 'returns 200 with "application/activity+json"' do
+        post :show, params: { id: 'featured', account_username: account.username }
+
+        expect(response).to have_http_status(200)
+        expect(response.content_type).to eq 'application/activity+json'
+      end
+    end
+
+    context 'id is not "featured"' do
+      it 'returns 404' do
+        post :show, params: { id: 'hoge', account_username: account.username }
+        expect(response).to have_http_status(404)
+      end
+    end
+  end
+end