about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorReverite <github@reverite.sh>2019-06-09 16:54:21 -0700
committerReverite <github@reverite.sh>2019-06-09 16:54:21 -0700
commit3614718bc91f90a6dc19dd80ecf3bc191283c24e (patch)
treead35f4dbe92fdbc3f95881d6be3d4f9b29d4a704 /spec
parent846a09a7435fb9eb435e9950175ee0e696ed4909 (diff)
parente16c8fbc7a2b5a866960a87bc8c950ad0d38f61b (diff)
Merge branch 'glitch' into production
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/api/v1/polls_controller_spec.rb18
-rw-r--r--spec/lib/activitypub/activity/announce_spec.rb18
-rw-r--r--spec/services/notify_service_spec.rb2
3 files changed, 19 insertions, 19 deletions
diff --git a/spec/controllers/api/v1/polls_controller_spec.rb b/spec/controllers/api/v1/polls_controller_spec.rb
index 2b8d5f3ef..851bccb7e 100644
--- a/spec/controllers/api/v1/polls_controller_spec.rb
+++ b/spec/controllers/api/v1/polls_controller_spec.rb
@@ -10,14 +10,26 @@ RSpec.describe Api::V1::PollsController, type: :controller do
   before { allow(controller).to receive(:doorkeeper_token) { token } }
 
   describe 'GET #show' do
-    let(:poll) { Fabricate(:poll) }
+    let(:poll) { Fabricate(:poll, status: Fabricate(:status, visibility: visibility)) }
 
     before do
       get :show, params: { id: poll.id }
     end
 
-    it 'returns http success' do
-      expect(response).to have_http_status(200)
+    context 'when parent status is public' do
+      let(:visibility) { 'public' }
+
+      it 'returns http success' do
+        expect(response).to have_http_status(200)
+      end
+    end
+
+    context 'when parent status is private' do
+      let(:visibility) { 'private' }
+
+      it 'returns http not found' do
+        expect(response).to have_http_status(404)
+      end
     end
   end
 end
diff --git a/spec/lib/activitypub/activity/announce_spec.rb b/spec/lib/activitypub/activity/announce_spec.rb
index 926083a4f..60fd96a18 100644
--- a/spec/lib/activitypub/activity/announce_spec.rb
+++ b/spec/lib/activitypub/activity/announce_spec.rb
@@ -58,21 +58,6 @@ RSpec.describe ActivityPub::Activity::Announce do
         end
       end
 
-      context 'self-boost of a previously unknown status with missing attributedTo' do
-        let(:object_json) do
-          {
-            id: 'https://example.com/actor#bar',
-            type: 'Note',
-            content: 'Lorem ipsum',
-            to: 'http://example.com/followers',
-          }
-        end
-
-        it 'creates a reblog by sender of status' do
-          expect(sender.reblogged?(sender.statuses.first)).to be true
-        end
-      end
-
       context 'self-boost of a previously unknown status with correct attributedTo' do
         let(:object_json) do
           {
@@ -122,6 +107,7 @@ RSpec.describe ActivityPub::Activity::Announce do
             type: 'Note',
             content: 'Lorem ipsum',
             to: 'http://example.com/followers',
+            attributedTo: 'https://example.com/actor',
           }
         end
 
@@ -141,6 +127,7 @@ RSpec.describe ActivityPub::Activity::Announce do
             type: 'Note',
             content: 'Lorem ipsum',
             to: 'http://example.com/followers',
+            attributedTo: 'https://example.com/actor',
           }
         end
 
@@ -161,6 +148,7 @@ RSpec.describe ActivityPub::Activity::Announce do
           type: 'Note',
           content: 'Lorem ipsum',
           to: 'http://example.com/followers',
+          attributedTo: 'https://example.com/actor',
         }
       end
 
diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb
index a68fdd8df..b09d335ba 100644
--- a/spec/services/notify_service_spec.rb
+++ b/spec/services/notify_service_spec.rb
@@ -105,7 +105,7 @@ RSpec.describe NotifyService, type: :service do
     end
 
     it 'shows reblogs when disabled' do
-      recipient.follow!(sender, reblogs: true)
+      recipient.follow!(sender, reblogs: false)
       is_expected.to change(Notification, :count)
     end
   end