about summary refs log tree commit diff
path: root/spec/workers
diff options
context:
space:
mode:
authorReverite <github@reverite.sh>2019-06-28 22:48:00 -0700
committerReverite <github@reverite.sh>2019-06-28 22:48:00 -0700
commit01e77afe9a0dc126506cfc98d8f5d330f4a2f076 (patch)
tree387f07d7180c0852832f7923a34562c9f385d91f /spec/workers
parent9861df046853b71370cede86afbba1a371714756 (diff)
parent98c2d2aa46c2725b360907cf5537338ac6d052ed (diff)
Merge branch 'glitch' into production
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/activitypub/distribute_poll_update_worker_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/workers/activitypub/distribute_poll_update_worker_spec.rb b/spec/workers/activitypub/distribute_poll_update_worker_spec.rb
new file mode 100644
index 000000000..7eb6119fd
--- /dev/null
+++ b/spec/workers/activitypub/distribute_poll_update_worker_spec.rb
@@ -0,0 +1,22 @@
+require 'rails_helper'
+
+describe ActivityPub::DistributePollUpdateWorker do
+  subject { described_class.new }
+
+  let(:account)  { Fabricate(:account) }
+  let(:follower) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example.com') }
+  let(:poll)     { Fabricate(:poll, account: account) }
+  let!(:status)  { Fabricate(:status, account: account, poll: poll) }
+
+  describe '#perform' do
+    before do
+      allow(ActivityPub::DeliveryWorker).to receive(:push_bulk)
+      follower.follow!(account)
+    end
+
+    it 'delivers to followers' do
+      subject.perform(status.id)
+      expect(ActivityPub::DeliveryWorker).to have_received(:push_bulk).with(['http://example.com'])
+    end
+  end
+end