test/plugins/job/throttle_test.rb in rocketjob-3.4.3 vs test/plugins/job/throttle_test.rb in rocketjob-3.5.0
- old
+ new
@@ -2,11 +2,10 @@
# Unit Test for RocketJob::Job
module Plugins
module Job
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
@@ -18,24 +17,24 @@
describe RocketJob::Plugins::Job::Throttle do
before do
RocketJob::Job.delete_all
end
- describe '.has_throttle?' do
+ describe '.throttle?' do
it 'defines the running jobs throttle' do
- assert ThrottleJob.has_throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
- refute ThrottleJob.has_throttle?(:blah?), ThrottleJob.rocket_job_throttles
+ assert ThrottleJob.throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
+ refute ThrottleJob.throttle?(:blah?), ThrottleJob.rocket_job_throttles
end
end
describe '.undefine_throttle' do
it 'undefines the running jobs throttle' do
- assert ThrottleJob.has_throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
+ assert ThrottleJob.throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
ThrottleJob.undefine_throttle(:throttle_running_jobs_exceeded?)
- refute ThrottleJob.has_throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
+ refute ThrottleJob.throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
ThrottleJob.define_throttle(:throttle_running_jobs_exceeded?)
- assert ThrottleJob.has_throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
+ assert ThrottleJob.throttle?(:throttle_running_jobs_exceeded?), ThrottleJob.rocket_job_throttles
end
end
describe '#throttle_running_jobs_exceeded??' do
it 'does not exceed throttle when no other jobs are running' do
@@ -104,10 +103,9 @@
filter = {}
assert_nil RocketJob::Job.rocket_job_next_job(@worker_name, filter), -> { ThrottleJob.all.to_a.ai }
assert_equal 1, filter.size
end
end
-
end
end
end
end