mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Adopt partials to use new Expectation type
This commit is contained in:
parent
718f24aef3
commit
b625cb69cf
2 changed files with 7 additions and 6 deletions
|
@ -20,5 +20,10 @@ module Spectator::Expectations
|
|||
# Creates the base of the partial.
|
||||
private def initialize(@label)
|
||||
end
|
||||
|
||||
# Reports an expectation to the current harness.
|
||||
private def report(expectation : Expectation)
|
||||
Internals::Harness.current.report_expectation(expectation)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,17 +24,13 @@ module Spectator::Expectations
|
|||
# Asserts that the `#actual` value matches some criteria.
|
||||
# The criteria is defined by the matcher passed to this method.
|
||||
def to(matcher : Matchers::ValueMatcher(ExpectedType)) : Nil forall ExpectedType
|
||||
expectation = ValueExpectation.new(self, matcher)
|
||||
result = expectation.eval
|
||||
Internals::Harness.current.report_expectation(result)
|
||||
report(matcher.eval(self))
|
||||
end
|
||||
|
||||
# Asserts that the `#actual` value *does not* match some criteria.
|
||||
# This is effectively the opposite of `#to`.
|
||||
def to_not(matcher : Matchers::ValueMatcher(ExpectedType)) : Nil forall ExpectedType
|
||||
expectation = ValueExpectation.new(self, matcher)
|
||||
result = expectation.eval(true)
|
||||
Internals::Harness.current.report_expectation(result)
|
||||
report(matcher.eval(self, true))
|
||||
end
|
||||
|
||||
# ditto
|
||||
|
|
Loading…
Reference in a new issue