mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix "should" syntax
This commit is contained in:
parent
ebfec8058e
commit
102105911c
1 changed files with 3 additions and 8 deletions
|
@ -20,18 +20,13 @@ class Object
|
||||||
# First argument of the `Expectation` initializer is the expression label.
|
# First argument of the `Expectation` initializer is the expression label.
|
||||||
# However, since this isn't a macro and we can't "look behind" this method call
|
# However, since this isn't a macro and we can't "look behind" this method call
|
||||||
# to see what it was invoked on, the argument is an empty string.
|
# to see what it was invoked on, the argument is an empty string.
|
||||||
expectation = ::Spectator::Expectation.new(self)
|
# Additionally, the source file and line can't be obtained.
|
||||||
unless matcher.match?(expectation)
|
::Spectator::Expectations::ValueExpectationPartial.new(self, __FILE__, __LINE__).to(matcher)
|
||||||
raise ::Spectator::ExpectationFailed.new(matcher.message(expectation))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Works the same as `#should` except the condition is inverted.
|
# Works the same as `#should` except the condition is inverted.
|
||||||
# When `#should` succeeds, this method will fail, and vice-versa.
|
# When `#should` succeeds, this method will fail, and vice-versa.
|
||||||
def should_not(matcher : ::Spectator::Matchers::Matcher)
|
def should_not(matcher : ::Spectator::Matchers::Matcher)
|
||||||
expectation = ::Spectator::Expectation.new(self)
|
::Spectator::Expectations::ValueExpectationPartial.new(self, __FILE__, __LINE__).to_not(matcher)
|
||||||
if matcher.match?(expectation)
|
|
||||||
raise ::Spectator::ExpectationFailed.new(matcher.message(expectation))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue