Skip to content

Commit

Permalink
Prefix class_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
sambostock committed Jul 6, 2022
1 parent 4b0ba59 commit 8186aad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/job-iteration/iteration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module Iteration
define_callbacks :complete

class_attribute(
:enforce_serializable_cursors,
:job_iteration_enforce_serializable_cursors,
instance_writer: false,
instance_predicate: false,
default: JobIteration.enforce_serializable_cursors,
Expand Down Expand Up @@ -224,7 +224,7 @@ def assert_valid_cursor!(cursor)
"Cursor must be composed of objects capable of built-in (de)serialization: " \
"Strings, Integers, Floats, Arrays, Hashes, true, false, or nil.",
cursor: cursor,
) if enforce_serializable_cursors
) if job_iteration_enforce_serializable_cursors

Deprecation.warn(<<~DEPRECATION_MESSAGE)
The Enumerator returned by #{self.class.name}#build_enumerator yielded a cursor which is unsafe to serialize.
Expand Down
6 changes: 3 additions & 3 deletions test/unit/iteration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def test_jobs_using_unserializable_cursor_will_raise_if_enforce_serializable_cur
def test_jobs_using_unserializable_cursor_will_raise_if_enforce_serializable_cursors_set_per_class
with_global_enforce_serializable_cursors(false) do
job_class = build_invalid_cursor_job(cursor: :unserializable)
job_class.enforce_serializable_cursors = true
job_class.job_iteration_enforce_serializable_cursors = true

assert_raises_cursor_error do
job_class.perform_now
Expand All @@ -267,7 +267,7 @@ def test_jobs_using_unserializable_cursor_will_raise_if_enforce_serializable_cur
def test_jobs_using_unserializable_cursor_will_raise_if_enforce_serializable_cursors_set_in_parent
with_global_enforce_serializable_cursors(false) do
parent = build_invalid_cursor_job(cursor: :unserializable)
parent.enforce_serializable_cursors = true
parent.job_iteration_enforce_serializable_cursors = true
child = Class.new(parent)

assert_raises_cursor_error do
Expand All @@ -279,7 +279,7 @@ def test_jobs_using_unserializable_cursor_will_raise_if_enforce_serializable_cur
def test_jobs_using_unserializable_cursor_will_not_raise_if_enforce_serializable_cursors_unset_per_class
with_global_enforce_serializable_cursors(true) do
job_class = build_invalid_cursor_job(cursor: :unserializable)
job_class.enforce_serializable_cursors = false
job_class.job_iteration_enforce_serializable_cursors = false

assert_nothing_raised do
job_class.perform_now
Expand Down

0 comments on commit 8186aad

Please sign in to comment.