about summary refs log tree commit diff
path: root/spec/workers/activitypub
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-07-01 19:23:14 +0200
committerThibaut Girka <thib@sitedethib.com>2020-07-01 19:23:14 +0200
commit45deca65b3fb8e9f19818e3db7d315cab0572d1a (patch)
tree1b9bab6ec764e8a6600d245595facd5694287e16 /spec/workers/activitypub
parent39a0622de70dc24275808cee9526658bd68a55ed (diff)
parent6d23d40420e4548778f3ca4ed9e8cb16e0eb0073 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/packs/public.js`:
  Conflict because part of that file has been split to
  `app/javascript/core/settings.js`. Ported those changes
  there.
Diffstat (limited to 'spec/workers/activitypub')
-rw-r--r--spec/workers/activitypub/move_distribution_worker_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/workers/activitypub/move_distribution_worker_spec.rb b/spec/workers/activitypub/move_distribution_worker_spec.rb
new file mode 100644
index 000000000..b52788e54
--- /dev/null
+++ b/spec/workers/activitypub/move_distribution_worker_spec.rb
@@ -0,0 +1,22 @@
+require 'rails_helper'
+
+describe ActivityPub::MoveDistributionWorker do
+  subject { described_class.new }
+
+  let(:migration)   { Fabricate(:account_migration) }
+  let(:follower) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example.com') }
+  let(:blocker) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example2.com') }
+
+  describe '#perform' do
+    before do
+      allow(ActivityPub::DeliveryWorker).to receive(:push_bulk)
+      follower.follow!(migration.account)
+      blocker.block!(migration.account)
+    end
+
+    it 'delivers to followers and known blockers' do
+      subject.perform(migration.id)
+        expect(ActivityPub::DeliveryWorker).to have_received(:push_bulk).with(['http://example.com', 'http://example2.com'])
+    end
+  end
+end