test/job_test.rb in rocketjob-1.2.1 vs test/job_test.rb in rocketjob-1.3.0
- old
+ new
@@ -152,11 +152,12 @@
it 'destroy on complete' do
@job.destroy_on_complete = true
@job.start!
assert_equal false, @job.work(@worker)
- assert_equal nil, RocketJob::Job.find_by_id(@job.id)
+ assert @job.completed?, @job.state
+ assert_equal 0, RocketJob::Job.where(id: @job.id).count
end
it 'silence logging when log_level is set' do
@job.destroy_on_complete = true
@job.log_level = :warn
@@ -252,12 +253,13 @@
describe '#requeue' do
it 'requeue jobs from dead workers' do
worker_name = 'server:12345'
@job.worker_name = worker_name
+ assert @job.valid?, @job.errors.messages
@job.start!
- assert @job.running?
+ assert @job.running?, @job.state
@job.requeue
assert @job.queued?
assert_equal nil, @job.worker_name
@@ -271,10 +273,10 @@
it 'requeue jobs from dead workers' do
assert_equal 52, @job2.priority
worker_name = 'server:12345'
@job.worker_name = worker_name
@job.start!
- assert @job.running?
+ assert @job.running?, @job.state
worker_name2 = 'server:76467'
@job2.worker_name = worker_name2
@job2.start!