mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Remove min-max variation of be_within
Use `be_between(min, max)` instead. This matches RSpec.
This commit is contained in:
parent
0fc28241dd
commit
fa5c13df0e
1 changed files with 4 additions and 24 deletions
|
@ -261,29 +261,6 @@ module Spectator::DSL
|
|||
::Spectator::Matchers::RangeMatcher.new({{expected}}, {{expected.stringify}})
|
||||
end
|
||||
|
||||
# Indicates that some value should be between a lower and upper-bound.
|
||||
#
|
||||
# Example:
|
||||
# ```
|
||||
# expect(7).to be_within(1, 10)
|
||||
# ```
|
||||
#
|
||||
# Additionally, an "inclusive" or "exclusive" suffix can be added.
|
||||
# These modify the upper-bound on the range being checked against.
|
||||
# By default, the range is inclusive.
|
||||
#
|
||||
# Examples:
|
||||
# ```
|
||||
# expect(days).to be_within(28, 31).inclusive # 28, 29, 30, or 31
|
||||
# expect(100).to be_within(97, 101).exclusive # 97, 98, 99, or 100 (not 101)
|
||||
# ```
|
||||
macro be_within(min, max)
|
||||
:Spectator::Matchers::RangeMatcher.new(
|
||||
Range.new({{min}}, {{max}}),
|
||||
[{{min.stringify}}, {{max.stringify}}].join(" to ")
|
||||
)
|
||||
end
|
||||
|
||||
# Indicates that some value should be between a lower and upper-bound.
|
||||
#
|
||||
# Example:
|
||||
|
@ -301,7 +278,10 @@ module Spectator::DSL
|
|||
# expect(100).to be_between(97, 101).exclusive # 97, 98, 99, or 100 (not 101)
|
||||
# ```
|
||||
macro be_between(min, max)
|
||||
be_within({{min}}, {{max}})
|
||||
:Spectator::Matchers::RangeMatcher.new(
|
||||
Range.new({{min}}, {{max}}),
|
||||
[{{min.stringify}}, {{max.stringify}}].join(" to ")
|
||||
)
|
||||
end
|
||||
|
||||
# Indicates that some value should be within a delta of an expected value.
|
||||
|
|
Loading…
Reference in a new issue