From b9abdb86ff924d9479dcc19bc475d1b5347bacb7 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Thu, 27 Sep 2018 16:28:47 -0600 Subject: [PATCH] Use actual value if label is empty This will show a value instead of nothing if the should-syntax is used. --- src/spectator/expectation.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/spectator/expectation.cr b/src/spectator/expectation.cr index 8d10b72..1a6623b 100644 --- a/src/spectator/expectation.cr +++ b/src/spectator/expectation.cr @@ -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