From 2af03164cbf0c3e86b551d9be338780c204ef9fa Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Feb 2022 19:42:45 +0100 Subject: Improve tests involving push_bulk (#17508) sidekiq-bulk's push_bulk can either accept arguments directly or run them through a block. Setting expectations on the result of evaluating the blocks allows testing more code (the block itself) and the test is moved closer to the *interface* of the tested code than its precise implementation. --- spec/workers/activitypub/move_distribution_worker_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'spec/workers/activitypub/move_distribution_worker_spec.rb') diff --git a/spec/workers/activitypub/move_distribution_worker_spec.rb b/spec/workers/activitypub/move_distribution_worker_spec.rb index b52788e54..af8c44cc0 100644 --- a/spec/workers/activitypub/move_distribution_worker_spec.rb +++ b/spec/workers/activitypub/move_distribution_worker_spec.rb @@ -9,14 +9,16 @@ describe ActivityPub::MoveDistributionWorker do 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 + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [ + [kind_of(String), migration.account.id, 'http://example.com'], + [kind_of(String), migration.account.id, 'http://example2.com'] + ]) subject.perform(migration.id) - expect(ActivityPub::DeliveryWorker).to have_received(:push_bulk).with(['http://example.com', 'http://example2.com']) end end end -- cgit