From 4f8c36ab707b7a262cd9b37d4a71e6234d9f8f3c Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sat, 19 Dec 2015 20:04:39 +0900 Subject: display detailed information in inline reporting The errors message only was not displayed, as if it did not use the inline reporting, modified to also information the method name and the like in error are displayed. ``` # before Failed assertion, no message given. bin/rails test test/models/user_test.rb:5 ``` ``` # after Failure: UserTest#test_the_truth: Failed assertion, no message given. bin/rails test test/models/user_test.rb:5 ``` --- railties/lib/rails/test_unit/reporter.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb index 00ea32d1b8..695c67756b 100644 --- a/railties/lib/rails/test_unit/reporter.rb +++ b/railties/lib/rails/test_unit/reporter.rb @@ -12,7 +12,7 @@ module Rails if output_inline? && result.failure && (!result.skipped? || options[:verbose]) io.puts io.puts - io.puts result.failures.map(&:message) + io.puts format_failures(result) io.puts io.puts format_rerun_snippet(result) io.puts @@ -56,6 +56,12 @@ module Rails options[:fail_fast] end + def format_failures(result) + result.failures.map do |failure| + "#{failure.result_label}:\n#{result.class}##{result.name}:\n#{failure.message}\n" + end + end + def format_rerun_snippet(result) # Try to extract path to assertion from backtrace. if result.location =~ /\[(.*)\]\z/ -- cgit v1.2.3