Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a couple extra tests for reserving jobs.

  • Loading branch information...
commit 411719b38c51a7fbd060ea139fd64adb20107a5d 1 parent c933ffc
Brian Ryckbost bryckbost authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/delayed/backend/shared_spec.rb
11 lib/delayed/backend/shared_spec.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.