about summary refs log tree commit diff
path: root/spec/lib/activitypub/activity/block_spec.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-07-22 15:39:36 +0200
committerGitHub <noreply@github.com>2020-07-22 15:39:36 +0200
commit4024952b58bacb94d2cb43fafddf0e97bea4c55c (patch)
treeb1c1e5cdb84606879d65ecceebe4cf665332379b /spec/lib/activitypub/activity/block_spec.rb
parent801e546ecc1efb4103232d8265229eb455a8dd5b (diff)
parentf8e315cd74d05a6878bbd018b20462daa0b5e660 (diff)
Merge pull request #1385 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/lib/activitypub/activity/block_spec.rb')
-rw-r--r--spec/lib/activitypub/activity/block_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/activitypub/activity/block_spec.rb b/spec/lib/activitypub/activity/block_spec.rb
index 94d37356d..42bdfdc81 100644
--- a/spec/lib/activitypub/activity/block_spec.rb
+++ b/spec/lib/activitypub/activity/block_spec.rb
@@ -28,6 +28,28 @@ RSpec.describe ActivityPub::Activity::Block do
     end
   end
 
+  context 'when the recipient is already blocked' do
+    before do
+      sender.block!(recipient, uri: 'old')
+    end
+
+    describe '#perform' do
+      subject { described_class.new(json, sender) }
+
+      before do
+        subject.perform
+      end
+
+      it 'creates a block from sender to recipient' do
+        expect(sender.blocking?(recipient)).to be true
+      end
+
+      it 'sets the uri to that of last received block activity' do
+        expect(sender.block_relationships.find_by(target_account: recipient).uri).to eq 'foo'
+      end
+    end
+  end
+
   context 'when the recipient follows the sender' do
     before do
       recipient.follow!(sender)