aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/test_unit/reporter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/test_unit/reporter.rb')
-rw-r--r--railties/lib/rails/test_unit/reporter.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb
index 64e99626eb..faf551f381 100644
--- a/railties/lib/rails/test_unit/reporter.rb
+++ b/railties/lib/rails/test_unit/reporter.rb
@@ -1,7 +1,11 @@
+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
return if results.empty?
io.puts
@@ -15,8 +19,12 @@ module Rails
filtered_results.reject!(&:skipped?) unless options[:verbose]
filtered_results.map do |result|
location, line = result.method(result.name).source_location
- "bin/rails test #{location}:#{line}"
+ "#{self.executable} #{relative_path_for(location)}:#{line}"
end.join "\n"
end
+
+ def relative_path_for(file)
+ file.sub(/^#{Rails.root}\/?/, '')
+ end
end
end