Move #eval to base class

Code is identical across sub-classes.
This commit is contained in:
Michael Miller 2019-01-31 13:34:09 -07:00
parent 3731b6d785
commit a633d41fae
3 changed files with 4 additions and 13 deletions

View file

@ -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

View file

@ -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)

View file

@ -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