Permalink
Browse files

Added a couple extra tests for reserving jobs.

  • Loading branch information...
1 parent c933ffc commit 411719b38c51a7fbd060ea139fd64adb20107a5d @bryckbost bryckbost committed Dec 8, 2010
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/delayed/backend/shared_spec.rb
@@ -155,6 +155,17 @@ def create_job(opts = {})
described_class.reserve(worker).should be_nil
end
+ it "should reserve jobs scheduled for the past" do
+ job = create_job :run_at => described_class.db_time_now - 1.minute
+ described_class.reserve(worker).should == job
+ end
+
+ it "should reserve jobs scheduled for the past when time zones are involved" do
+ Time.zone = 'US/Eastern'
+ job = create_job :run_at => described_class.db_time_now - 1.minute.ago.in_time_zone
+ described_class.reserve(worker).should == job
+ end
+
it "should not reserve jobs locked by other workers" do
job = create_job
other_worker = Delayed::Worker.new

0 comments on commit 411719b

Please sign in to comment.