Skip to content

Commit

Permalink
Merge pull request #149 from Shopify/enforce-throttle-enumerator-wrap…
Browse files Browse the repository at this point in the history
…s-other-enumerator
  • Loading branch information
sambostock authored Nov 15, 2021
2 parents 3213bb5 + 93c2da4 commit 4730c21
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 4730c21

Please sign in to comment.