【发布时间】:2013-01-25 14:23:29
【问题描述】:
我正在使用 Rspec 测试我的 Delayed::Job。
在我的 rspec_controller 中:
it "queues up delayed job and fires" do
setup
expect {
post :create, {:job => valid_attributes}
}.to change(Delayed::Job, :count).by(2)
Delayed::Worker.new.work_off.should == [2,0]
end
Delayed::Job.count按预期通过,但Delayed::Worker.new.work_off返回[0,0],表示有2个job时成功0次,失败0次。
我应该如何调试以找出为什么 work_off 没有解雇这些工作。
编辑:应该运行的 2 个作业,将它们的 run_at 设置为未来。 work_off 是否会解雇不应该立即执行的工作?
【问题讨论】:
标签: ruby-on-rails-3 rspec delayed-job