diff options
Diffstat (limited to 'railties/lib/rails/test_unit/reporter.rb')
-rw-r--r-- | railties/lib/rails/test_unit/reporter.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb new file mode 100644 index 0000000000..bfdc9754d4 --- /dev/null +++ b/railties/lib/rails/test_unit/reporter.rb @@ -0,0 +1,26 @@ +require "minitest" + +module Rails + class TestUnitReporter < Minitest::StatisticsReporter + def report + return if results.empty? + io.puts + io.puts "Failed tests:" + io.puts + io.puts aggregated_results + end + + def aggregated_results # :nodoc: + filtered_results = results.dup + filtered_results.reject!(&:skipped?) unless options[:verbose] + filtered_results.map do |result| + location, line = result.method(result.name).source_location + "bin/rails test #{relative_path_for(location)}:#{line}" + end.join "\n" + end + + def relative_path_for(file) + file.sub(/^#{Rails.root}\/?/, '') + end + end +end |