about summary refs log tree commit diff
path: root/spec/services/unfollow_service_spec.rb
diff options
context:
space:
mode:
authorpluralcafe-docker <git@plural.cafe>2019-01-21 04:35:29 +0000
committerpluralcafe-docker <git@plural.cafe>2019-01-21 04:35:29 +0000
commitb7c67605d5c2110b4a3cd3d8a7b8ef2878cbfe48 (patch)
treea3344b6105b7771983f69c789fb2f7a0c22a8583 /spec/services/unfollow_service_spec.rb
parentfb7ec403227690f897a9a693f2461b94bf7e2582 (diff)
parentaa362ab73dc7121104b3c01800152b9fc56ea396 (diff)
Merge branch 'glitch'
Diffstat (limited to 'spec/services/unfollow_service_spec.rb')
-rw-r--r--spec/services/unfollow_service_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/unfollow_service_spec.rb b/spec/services/unfollow_service_spec.rb
index c5914c818..8a2881ab1 100644
--- a/spec/services/unfollow_service_spec.rb
+++ b/spec/services/unfollow_service_spec.rb
@@ -56,4 +56,22 @@ RSpec.describe UnfollowService, type: :service do
       expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
     end
   end
+
+  describe 'remote ActivityPub (reverse)' do
+    let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox')).account }
+
+    before do
+      bob.follow!(sender)
+      stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
+      subject.call(bob, sender)
+    end
+
+    it 'destroys the following relation' do
+      expect(bob.following?(sender)).to be false
+    end
+
+    it 'sends a reject activity' do
+      expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
+    end
+  end
 end