test/plugins/job/throttle_test.rb in rocketjob-3.3.0 vs test/plugins/job/throttle_test.rb in rocketjob-3.3.1

- old
+ new

@@ -6,10 +6,11 @@ class ThrottleTest < Minitest::Test class ThrottleJob < RocketJob::Job # Only allow one to be processed at a time self.throttle_running_jobs = 1 + self.pausable = true def perform 21 end end @@ -83,26 +84,26 @@ it 'return the job when others are queued, paused, failed, or complete' do @job = ThrottleJob.create! ThrottleJob.create!(state: :failed) ThrottleJob.create!(state: :complete) ThrottleJob.create!(state: :paused) - assert job = RocketJob::Job.rocket_job_next_job(@worker_name), -> { ThrottleJob.all.to_a.ai } - assert_equal @job.id, job.id, -> { ThrottleJob.all.to_a.ai } + assert job = RocketJob::Job.rocket_job_next_job(@worker_name), -> {ThrottleJob.all.to_a.ai} + assert_equal @job.id, job.id, -> {ThrottleJob.all.to_a.ai} end it 'return nil when other jobs are running' do ThrottleJob.create! @job = ThrottleJob.new @job.start! - assert_nil RocketJob::Job.rocket_job_next_job(@worker_name), -> { ThrottleJob.all.to_a.ai } + assert_nil RocketJob::Job.rocket_job_next_job(@worker_name), -> {ThrottleJob.all.to_a.ai} end it 'add job to filter when other jobs are running' do ThrottleJob.create! @job = ThrottleJob.new @job.start! filter = {} - assert_nil RocketJob::Job.rocket_job_next_job(@worker_name, filter), -> { ThrottleJob.all.to_a.ai } + assert_nil RocketJob::Job.rocket_job_next_job(@worker_name, filter), -> {ThrottleJob.all.to_a.ai} assert_equal 1, filter.size end end end