aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-22 20:10:58 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-22 20:10:58 -0300
commitf7ac57e8d88de18ab33beaf8a8bec1773f3e8b6e (patch)
tree3bf6ce6efae50022d120b854e38d699c10b34c49 /railties
parent7814d80897dffb82bf8da15d8c2c76efc3805a9a (diff)
parent1d3e0f5872c072d7811a2878dd0e86c82031b43f (diff)
downloadrails-f7ac57e8d88de18ab33beaf8a8bec1773f3e8b6e.tar.gz
rails-f7ac57e8d88de18ab33beaf8a8bec1773f3e8b6e.tar.bz2
rails-f7ac57e8d88de18ab33beaf8a8bec1773f3e8b6e.zip
Merge pull request #20667 from y-yagi/do_not_show_failed_messages
do not show "Failed tests" message when a failed test is not
Diffstat (limited to 'railties')
-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