diff --git a/app/workers/receive_local_batch.rb b/app/workers/receive_local_batch.rb index adcf312aa..e243edf5c 100644 --- a/app/workers/receive_local_batch.rb +++ b/app/workers/receive_local_batch.rb @@ -10,7 +10,7 @@ module Workers object = object_class_string.constantize.find(object_id) receiver = Postzord::Receiver::LocalBatch.new(object, recipient_user_ids) receiver.perform! - rescue ActiveRecord::NotFound # Already deleted before the job could run + rescue ActiveRecord::RecordNotFound # Already deleted before the job could run end end end diff --git a/spec/workers/receive_local_batch_spec.rb b/spec/workers/receive_local_batch_spec.rb new file mode 100644 index 000000000..acd841cf3 --- /dev/null +++ b/spec/workers/receive_local_batch_spec.rb @@ -0,0 +1,14 @@ +require "spec_helper" + +describe Workers::ReceiveLocalBatch do + it "calls the postzord" do + post = double + allow(Post).to receive(:find).with(1).and_return(post) + + zord = double + expect(Postzord::Receiver::LocalBatch).to receive(:new).with(post, [2]).and_return(zord) + expect(zord).to receive(:perform!) + + Workers::ReceiveLocalBatch.new.perform("Post", 1, [2]) + end +end