diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-06-23 07:53:17 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-06-23 07:53:17 +0900 |
commit | 1d3e0f5872c072d7811a2878dd0e86c82031b43f (patch) | |
tree | 7183f356bfacd4d2830104ef6dde3ebae2c225ce /railties | |
parent | 73aa66342e685b21ece23192bcb0e79c069e962a (diff) | |
download | rails-1d3e0f5872c072d7811a2878dd0e86c82031b43f.tar.gz rails-1d3e0f5872c072d7811a2878dd0e86c82031b43f.tar.bz2 rails-1d3e0f5872c072d7811a2878dd0e86c82031b43f.zip |
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.rb | 12 | ||||
-rw-r--r-- | railties/test/test_unit/reporter_test.rb | 1 |
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 |