diff --git a/test/integration/integration_behaviour.rb b/test/integration/integration_behaviour.rb index 36a716c4..89dd3602 100644 --- a/test/integration/integration_behaviour.rb +++ b/test/integration/integration_behaviour.rb @@ -35,7 +35,7 @@ module IntegrationBehaviour end test "unserializable corruption is prevented" do - skip "Deferred until 2.0.0" + skip_until_version("2.0.0") # Cursors are serialized as JSON, but not all objects are serializable. # time = Time.at(0).utc # => 1970-01-01 00:00:00 UTC # json = JSON.dump(time) # => "\"1970-01-01 00:00:00 UTC\"" diff --git a/test/test_helper.rb b/test/test_helper.rb index b7a0b197..29a3bc6c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -96,6 +96,10 @@ class TestCase setup do Redis.current.flushdb end + + def skip_until_version(version) + skip("Deferred until version #{version}") if Gem::Version.new(JobIteration::VERSION) < Gem::Version.new(version) + end end end diff --git a/test/unit/iteration_test.rb b/test/unit/iteration_test.rb index 164f01fd..a64bfff9 100644 --- a/test/unit/iteration_test.rb +++ b/test/unit/iteration_test.rb @@ -200,38 +200,38 @@ def foo end def test_jobs_using_time_cursor_will_raise - skip("Deferred until 2.0.0") + skip_until_version("2.0.0") push(JobWithTimeCursor) assert_raises_cursor_error { work_one_job } end def test_jobs_using_active_record_cursor_will_raise - skip("Deferred until 2.0.0") + skip_until_version("2.0.0") refute_nil(Product.first) push(JobWithActiveRecordCursor) assert_raises_cursor_error { work_one_job } end def test_jobs_using_symbol_cursor_will_raise - skip("Deferred until 2.0.0") + skip_until_version("2.0.0") push(JobWithSymbolCursor) assert_raises_cursor_error { work_one_job } end def test_jobs_using_string_subclass_cursor_will_raise - skip("Deferred until 2.0.0") + skip_until_version("2.0.0") push(JobWithStringSubclassCursor) assert_raises_cursor_error { work_one_job } end def test_jobs_using_basic_object_cursor_will_raise - skip("Deferred until 2.0.0") + skip_until_version("2.0.0") push(JobWithBasicObjectCursor) assert_raises_cursor_error { work_one_job } end def test_jobs_using_complex_but_serializable_cursor_will_not_raise - skip("Deferred until 2.0.0") + skip_until_version("2.0.0") push(JobWithComplexCursor) work_one_job end