test/job_test.rb in rocketjob-0.7.0 vs test/job_test.rb in rocketjob-0.8.0

- old
+ new

@@ -20,11 +20,11 @@ @job.destroy if @job && !@job.new_record? end context '.config' do should 'support multiple databases' do - assert_equal 'test_rocket_job', RocketJob::Job.collection.db.name + assert_equal 'test_rocketjob', RocketJob::Job.collection.db.name end end context '#reload' do should 'handle hash' do @@ -53,14 +53,12 @@ assert_equal false, @job.destroy_on_complete assert_nil @job.expires_at assert_equal @arguments, @job.arguments assert_equal 0, @job.percent_complete assert_equal 50, @job.priority - assert_equal true, @job.repeatable assert_equal 0, @job.failure_count assert_nil @job.run_at - assert_nil @job.schedule assert_nil @job.started_at assert_equal :queued, @job.state end end @@ -177,9 +175,17 @@ should 'Process future dated jobs when time is now' do @job.run_at = Time.now @job.save! assert job = RocketJob::Job.next_job(@server.name), "Failed to find future job" assert_equal @job.id, job.id + end + + should 'Skip expired jobs' do + count = RocketJob::Job.count + @job.expires_at = Time.now - 100 + @job.save! + assert_equal nil, RocketJob::Job.next_job(@server.name) + assert_equal count, RocketJob::Job.count end end end end