Skip to content

Commit

Permalink
spec for dirty tracking fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Nov 13, 2010
1 parent 8d0742b commit 0257c78
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def job_create(opts = {})
# reset defaults
Delayed::Worker.destroy_failed_jobs = true
Delayed::Worker.max_attempts = 25
Delayed::Job.delete_all

@job = Delayed::Job.enqueue ErrorJob.new
end
Expand All @@ -120,13 +121,15 @@ def job_create(opts = {})
end

it "should re-schedule jobs after failing" do
@worker.run(@job)
@worker.work_off
@job.reload
@job.last_error.should =~ /did not work/
@job.last_error.should =~ /sample_jobs.rb:8:in `perform'/
@job.attempts.should == 1
@job.run_at.should > Delayed::Job.db_time_now - 10.minutes
@job.run_at.should < Delayed::Job.db_time_now + 10.minutes
@job.locked_at.should be_nil
@job.locked_by.should be_nil
end
end

Expand Down

0 comments on commit 0257c78

Please sign in to comment.