Rescue correct constant in Workers::ReceiveLocalBatch

Fixes #5834
This commit is contained in:
Jonne Haß 2015-04-01 04:00:49 +02:00
parent 5c78ab6838
commit 548b0d8161
2 changed files with 15 additions and 1 deletions

View file

@ -10,7 +10,7 @@ module Workers
object = object_class_string.constantize.find(object_id) object = object_class_string.constantize.find(object_id)
receiver = Postzord::Receiver::LocalBatch.new(object, recipient_user_ids) receiver = Postzord::Receiver::LocalBatch.new(object, recipient_user_ids)
receiver.perform! 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 end
end end

View file

@ -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