diff --git a/src/spectator/expectations/value_expectation_partial.cr b/src/spectator/expectations/value_expectation_partial.cr index 5955817..a9767d9 100644 --- a/src/spectator/expectations/value_expectation_partial.cr +++ b/src/spectator/expectations/value_expectation_partial.cr @@ -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