about summary refs log tree commit diff
path: root/spec/models/follow_spec.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-17 16:24:56 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-08-17 16:24:56 +0200
commit59f7f4c923494bb8dd6f2881a1610c7b51240d9c (patch)
tree9f01be5d65a9cdecfb92a7276e462bd6ab6db8e2 /spec/models/follow_spec.rb
parent1ee675d68bfd2034183a03408a2377c338dfac41 (diff)
Implement Undo { Accept { Follow } } (fixes #8234) (#8245)
* Add Follow#revoke_request!

* Implement Undo { Accept { Follow } } (fixes #8234)
Diffstat (limited to 'spec/models/follow_spec.rb')
-rw-r--r--spec/models/follow_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb
index 43175d852..f221973b6 100644
--- a/spec/models/follow_spec.rb
+++ b/spec/models/follow_spec.rb
@@ -37,4 +37,20 @@ RSpec.describe Follow, type: :model do
       expect(a[1]).to eq follow0
     end
   end
+
+  describe 'revoke_request!' do
+    let(:follow)         { Fabricate(:follow, account: account, target_account: target_account) }
+    let(:account)        { Fabricate(:account) }
+    let(:target_account) { Fabricate(:account) }
+
+    it 'revokes the follow relation' do
+      follow.revoke_request!
+      expect(account.following?(target_account)).to be false
+    end
+
+    it 'creates a follow request' do
+      follow.revoke_request!
+      expect(account.requested?(target_account)).to be true
+    end
+  end
 end