From 6307024af33a50c5788ee6af8f15d3afd235803d Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 3 Mar 2019 10:26:03 -0700 Subject: [PATCH] Colorize matcher values green and red --- src/spectator/formatting/failure_block.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spectator/formatting/failure_block.cr b/src/spectator/formatting/failure_block.cr index 0347c31..6d241bd 100644 --- a/src/spectator/formatting/failure_block.cr +++ b/src/spectator/formatting/failure_block.cr @@ -65,8 +65,12 @@ module Spectator::Formatting # Produces the values list for an expectation private def matcher_values(indent, expectation) MatchDataValues.new(expectation.values).each do |pair| - # TODO: Not all expectations will be failures (color green and red). - indent.line(Color.failure(pair)) + colored_pair = if expectation.satisfied? + Color.success(pair) + else + Color.failure(pair) + end + indent.line(colored_pair) end end