aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/lib/rails/test_unit/reporter.rb12
-rw-r--r--railties/test/test_unit/reporter_test.rb1
2 files changed, 10 insertions, 3 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb
index faf551f381..09b8675cf8 100644
--- a/railties/lib/rails/test_unit/reporter.rb
+++ b/railties/lib/rails/test_unit/reporter.rb
@@ -7,7 +7,7 @@ module Rails
self.executable = "bin/rails test"
def report
- return if results.empty?
+ return if filtered_results.empty?
io.puts
io.puts "Failed tests:"
io.puts
@@ -15,14 +15,20 @@ module Rails
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
"#{self.executable} #{relative_path_for(location)}:#{line}"
end.join "\n"
end
+ def filtered_results
+ if options[:verbose]
+ results
+ else
+ results.reject(&:skipped?)
+ end
+ end
+
def relative_path_for(file)
file.sub(/^#{Rails.root}\/?/, '')
end
diff --git a/railties/test/test_unit/reporter_test.rb b/railties/test/test_unit/reporter_test.rb
index f9c7888bc6..3066ba82d6 100644
--- a/railties/test/test_unit/reporter_test.rb
+++ b/railties/test/test_unit/reporter_test.rb
@@ -32,6 +32,7 @@ class TestUnitReporterTest < ActiveSupport::TestCase
@reporter.record(passing_test)
@reporter.record(skipped_test)
@reporter.report
+ assert_no_match 'Failed tests:', @output.string
assert_rerun_snippet_count 0
end