Skip to content

Commit

Permalink
Add test for future enforcement of Enumerator class
Browse files Browse the repository at this point in the history
In 2.0.0 we should enforce the class of the object wrapped by
ThrottleEnumerator, to match our enforment that build_enumerator return
an Enumerator object.
  • Loading branch information
sambostock committed Nov 13, 2021
1 parent 3213bb5 commit 93c2da4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/unit/throttle_enumerator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ def each_iteration(_record, _params); end
})
end

test "can only wrap another enumerator" do
skip("Deferred until 2.0.0")
error = assert_raises(ArgumentError) do
CustomizableThrottleJob.perform_now({
enumerator: [],
throttle_on: -> { true },
})
end
assert_equal("wrapped object must be Enumerator, not Array", error.message)
end

test "throttle event is instrumented" do
IterationThrottleJob.should_throttle_sequence = [true]

Expand Down

0 comments on commit 93c2da4

Please sign in to comment.