From 07e3d9d3b31b98ea3fd90b1dded9081d363d9d19 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 2 Apr 2015 08:24:04 -0700 Subject: [PATCH] Improve error output --- test/test_color_threshold.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/test_color_threshold.rb b/test/test_color_threshold.rb index 48c1205f..14eec913 100644 --- a/test/test_color_threshold.rb +++ b/test/test_color_threshold.rb @@ -6,14 +6,11 @@ class TestColorThreshold < Minitest::Test def test_color_threshold langs_with_colors = Language.all.reject { |language| language.color.nil? } cp = ColorProximity.new(10, langs_with_colors.map(&:color)) - failing_threshold = [] - langs_with_colors.each do |lang| + failing_threshold = langs_with_colors.map do |lang| state = cp.within_threshold?(lang.color[1..-1]) - unless state.first - failing_threshold << [lang, state.last] - end - end - message = "The following languages have failing color thresholds. Please modify the hex color.\n#{failing_threshold}" + "- #{lang} (#{lang.color}) is close to #{state.last}" unless state.first + end.compact + message = "The following languages have failing color thresholds. Please modify the hex color.\n#{failing_threshold.join("\n")}" assert failing_threshold.empty?, message end