about summary refs log tree commit diff
path: root/spec/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-06-14 18:01:35 +0200
committerGitHub <noreply@github.com>2017-06-14 18:01:35 +0200
commite17c2e5da5010beaefb46c8fffe35e87cb28f407 (patch)
tree5044d517e80ea2e152621da3520992648bcca42b /spec/workers
parent4a618908e836ecb94f70e99f2198ee7b3ba3b2ec (diff)
Batched remove status service (#3735)
* Make Pubsubhubbub::DistributionWorker handle both single stream entry
arguments, as well as arrays of stream entries

* Add BatchedRemoveStatusService, make SuspendAccountService use it

* Improve method names

* Add test

* Add more tests

* Use PuSH payloads of 100 to have a clear mapping of
1000 input statuses -> 10 PuSH payloads

It was nice while it lasted
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/pubsubhubbub/distribution_worker_spec.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/spec/workers/pubsubhubbub/distribution_worker_spec.rb b/spec/workers/pubsubhubbub/distribution_worker_spec.rb
index 512adb04c..89191c084 100644
--- a/spec/workers/pubsubhubbub/distribution_worker_spec.rb
+++ b/spec/workers/pubsubhubbub/distribution_worker_spec.rb
@@ -16,10 +16,9 @@ describe Pubsubhubbub::DistributionWorker do
     let(:status) { Fabricate(:status, account: alice, text: 'Hello', visibility: :public) }
 
     it 'delivers payload to all subscriptions' do
-      allow(Pubsubhubbub::DeliveryWorker).to receive(:perform_async)
+      allow(Pubsubhubbub::DeliveryWorker).to receive(:push_bulk)
       subject.perform(status.stream_entry.id)
-      expect(Pubsubhubbub::DeliveryWorker).to have_received(:perform_async).with(subscription_with_follower.id, /.*/)
-      expect(Pubsubhubbub::DeliveryWorker).to have_received(:perform_async).with(anonymous_subscription.id, /.*/)
+      expect(Pubsubhubbub::DeliveryWorker).to have_received(:push_bulk).with([anonymous_subscription, subscription_with_follower])
     end
   end
 
@@ -27,10 +26,10 @@ describe Pubsubhubbub::DistributionWorker do
     let(:status) { Fabricate(:status, account: alice, text: 'Hello', visibility: :private) }
 
     it 'delivers payload only to subscriptions with followers' do
-      allow(Pubsubhubbub::DeliveryWorker).to receive(:perform_async)
+      allow(Pubsubhubbub::DeliveryWorker).to receive(:push_bulk)
       subject.perform(status.stream_entry.id)
-      expect(Pubsubhubbub::DeliveryWorker).to have_received(:perform_async).with(subscription_with_follower.id, /.*/)
-      expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:perform_async).with(anonymous_subscription.id, /.*/)
+      expect(Pubsubhubbub::DeliveryWorker).to have_received(:push_bulk).with([subscription_with_follower])
+      expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:push_bulk).with([anonymous_subscription])
     end
   end
 
@@ -38,9 +37,9 @@ describe Pubsubhubbub::DistributionWorker do
     let(:status) { Fabricate(:status, account: alice, text: 'Hello', visibility: :direct) }
 
     it 'does not deliver payload' do
-      allow(Pubsubhubbub::DeliveryWorker).to receive(:perform_async)
+      allow(Pubsubhubbub::DeliveryWorker).to receive(:push_bulk)
       subject.perform(status.stream_entry.id)
-      expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:perform_async)
+      expect(Pubsubhubbub::DeliveryWorker).to_not have_received(:push_bulk)
     end
   end
 end