From 7ad0c5710647ac3cb182da12580ce20057f0db34 Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Mon, 4 Jul 2022 10:59:48 -0400 Subject: [PATCH] [FIXUP] Add test for unsetting explicit global --- test/unit/iteration_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/unit/iteration_test.rb b/test/unit/iteration_test.rb index 0e7c3971..0e44c0a2 100644 --- a/test/unit/iteration_test.rb +++ b/test/unit/iteration_test.rb @@ -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