Skip to content

Commit

Permalink
[FIXUP] Add test for unsetting explicit global
Browse files Browse the repository at this point in the history
  • Loading branch information
sambostock committed Jul 4, 2022
1 parent 07ab3ac commit 7ad0c57
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/unit/iteration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,23 @@ def test_per_class_max_job_runtime_with_global_set
end
end

def test_max_job_runtime_cannot_unset_global
with_global_max_job_runtime(30.seconds) do
klass = Class.new(ActiveJob::Base) do
include JobIteration::Iteration
end

error = assert_raises(ArgumentError) do
klass.max_job_runtime = nil
end

assert_equal(
"max_job_runtime may only decrease; #{klass} tried to increase it from 30 seconds to nil (no limit)",
error.message,
)
end
end

def test_max_job_runtime_cannot_be_higher_than_global
with_global_max_job_runtime(30.seconds) do
klass = Class.new(ActiveJob::Base) do
Expand Down

0 comments on commit 7ad0c57

Please sign in to comment.