mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add all-matcher to DSL
This commit is contained in:
parent
8520697efa
commit
0cb77b3355
1 changed files with 13 additions and 0 deletions
|
@ -526,6 +526,19 @@ module Spectator::DSL
|
|||
::Spectator::Matchers::AttributesMatcher.new(%test_value)
|
||||
end
|
||||
|
||||
# Verifies that all elements of a collection satisfy some matcher.
|
||||
# The collection should implement `Enumerable`.
|
||||
#
|
||||
# Examples:
|
||||
# ```
|
||||
# array = [1, 2, 3, 4]
|
||||
# expect(array).to all(be_even) # Fails.
|
||||
# expect(array).to all(be_lt(5)) # Passes.
|
||||
# ```
|
||||
macro all(matcher)
|
||||
::Spectator::Matchers::AllMatcher.new({{matcher}})
|
||||
end
|
||||
|
||||
# Indicates that some expression's value should change after taking an action.
|
||||
#
|
||||
# Examples:
|
||||
|
|
Loading…
Reference in a new issue