mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Move #eval to base class
Code is identical across sub-classes.
This commit is contained in:
parent
3731b6d785
commit
a633d41fae
3 changed files with 4 additions and 13 deletions
|
@ -21,11 +21,5 @@ module Spectator::Expectations
|
|||
protected def initialize(@block : -> ReturnType)
|
||||
super(@block.to_s)
|
||||
end
|
||||
|
||||
# Evaluates the expectation and returns it.
|
||||
private def eval(matcher, negated = false) : Expectation
|
||||
matched = matcher.match?(self)
|
||||
Expectation.new(matched, negated, self, matcher)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,10 @@ module Spectator::Expectations
|
|||
end
|
||||
|
||||
# Evaluates the expectation and returns it.
|
||||
private abstract def eval(matcher, negated = false) : Expectation
|
||||
private def eval(matcher, negated = false)
|
||||
matched = matcher.match?(self)
|
||||
Expectation.new(matched, negated, self, matcher)
|
||||
end
|
||||
|
||||
# Reports an expectation to the current harness.
|
||||
private def report(expectation : Expectation)
|
||||
|
|
|
@ -20,11 +20,5 @@ module Spectator::Expectations
|
|||
protected def initialize(@actual : ActualType)
|
||||
super(@actual.to_s)
|
||||
end
|
||||
|
||||
# Evaluates the expectation and returns it.
|
||||
private def eval(matcher, negated = false) : Expectation
|
||||
matched = matcher.match?(self)
|
||||
Expectation.new(matched, negated, self, matcher)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue