aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/test_unit
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-12-23 23:45:56 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2015-12-23 23:45:56 +0100
commitaf85e8a987ace926a5d0c21b87a68e2664cfba19 (patch)
treed5840635cdf056824d845f452e01c6432c619fd5 /railties/lib/rails/test_unit
parent55cf46d44f95129c7a00681710ffb15d0bdcf948 (diff)
downloadrails-af85e8a987ace926a5d0c21b87a68e2664cfba19.tar.gz
rails-af85e8a987ace926a5d0c21b87a68e2664cfba19.tar.bz2
rails-af85e8a987ace926a5d0c21b87a68e2664cfba19.zip
Remove local variable color.
Focus `color_output`'s intent on coloring output by a result. We aren't meant to pass it arbitrary codes to color output.
Diffstat (limited to 'railties/lib/rails/test_unit')
-rw-r--r--railties/lib/rails/test_unit/reporter.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb
index b97d6f86f2..17dfb8bcea 100644
--- a/railties/lib/rails/test_unit/reporter.rb
+++ b/railties/lib/rails/test_unit/reporter.rb
@@ -21,18 +21,17 @@ module Rails
def record(result)
super
- color = COLOR_CODES_FOR_RESULTS[result.result_code]
if options[:verbose]
- io.puts color_output(format_line(result), color)
+ io.puts color_output(format_line(result), by: result)
else
- io.print color_output(result.result_code, color)
+ io.print color_output(result.result_code, by: result)
end
if output_inline? && result.failure && (!result.skipped? || options[:verbose])
io.puts
io.puts
- io.puts format_failures(result).map { |line| color_output(line, color) }
+ io.puts format_failures(result).map { |line| color_output(line, by: result) }
io.puts
io.puts format_rerun_snippet(result)
io.puts
@@ -105,8 +104,9 @@ module Rails
options[:color] && io.respond_to?(:tty?) && io.tty?
end
- def color_output(string, color)
+ def color_output(string, by:)
if colored_output?
+ color = COLOR_CODES_FOR_RESULTS[by.result_code]
"\e[#{COLOR_CODES[color]}m#{string}\e[0m"
else
string