mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add DSL for be_close
matcher
This commit is contained in:
parent
196b4d97a5
commit
5389a39231
2 changed files with 16 additions and 1 deletions
|
@ -263,6 +263,21 @@ module Spectator::DSL
|
|||
)
|
||||
end
|
||||
|
||||
# Indicates that some value should be within a delta of an expected value.
|
||||
#
|
||||
# Example:
|
||||
# ```
|
||||
# expect(pi).to be_close(3.14159265359, 0.0000001)
|
||||
# ```
|
||||
#
|
||||
# This is functionly equivalent to:
|
||||
# ```
|
||||
# be_within(expected).of(delta)
|
||||
# ```
|
||||
macro be_close(expected, delta)
|
||||
be_within({{delta}}).of({{expected}})
|
||||
end
|
||||
|
||||
# Indicates that some value should or should not be nil.
|
||||
#
|
||||
# Examples:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue