Display actual value if label is empty

This commit is contained in:
Michael Miller 2018-10-07 12:49:10 -06:00
parent 38da6615bf
commit 7277b3caaf
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,12 @@ module Spectator::Expectations
super(label)
end
# Returns the actual value as a string
# if there's no label available.
def label
super.empty? ? actual.to_s : super
end
# 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