mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add #by modifier methods
This commit is contained in:
parent
848f80ddf8
commit
c19f442e6c
2 changed files with 10 additions and 0 deletions
|
@ -67,6 +67,11 @@ module Spectator::Matchers
|
|||
ChangeExactMatcher.new(@expression, @expected, value)
|
||||
end
|
||||
|
||||
# Specifies what the resulting value of the expression should change by.
|
||||
def by(amount : T) forall T
|
||||
ChangeExactMatcher.new(@expression, @expected, @expected + value)
|
||||
end
|
||||
|
||||
# Performs the change and reports the before and after values.
|
||||
private def change(actual)
|
||||
before = expression.value # Retrieve the expression's initial value.
|
||||
|
|
|
@ -61,6 +61,11 @@ module Spectator::Matchers
|
|||
ChangeExactMatcher.new(@expression, value, @expected)
|
||||
end
|
||||
|
||||
# Specifies how much the initial value should change by.
|
||||
def by(amount : T) forall T
|
||||
ChangeExactMatcher.new(@expression, @expected - amount, @expected)
|
||||
end
|
||||
|
||||
# Performs the change and reports the before and after values.
|
||||
private def change(actual)
|
||||
before = expression.value # Retrieve the expression's initial value.
|
||||
|
|
Loading…
Reference in a new issue