1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/test_unit/reporter.rb

31 lines
793 B
Ruby
Raw Normal View History

require "active_support/core_ext/class/attribute"
require "minitest"
module Rails
class TestUnitReporter < Minitest::StatisticsReporter
class_attribute :executable
self.executable = "bin/rails test"
def report
2015-02-03 21:54:50 -05:00
return if results.empty?
io.puts
2015-01-24 05:48:17 -05:00
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|
2015-01-23 22:57:52 -05:00
location, line = result.method(result.name).source_location
"#{self.executable} #{relative_path_for(location)}:#{line}"
2015-01-23 22:57:52 -05:00
end.join "\n"
end
def relative_path_for(file)
file.sub(/^#{Rails.root}\/?/, '')
end
end
end