Use actual value if label is empty

This will show a value instead of nothing if the should-syntax is used.
This commit is contained in:
Michael Miller 2018-09-27 16:28:47 -06:00
parent 77b4c71c2a
commit b9abdb86ff

View file

@ -2,9 +2,12 @@ require "./matchers/matcher"
module Spectator
class Expectation(T)
protected getter label : String
getter actual : T
protected def label : String
@label.empty? ? @actual.to_s : @label
end
protected def initialize(@label : String, @actual : T)
end