diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-02-16 22:37:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-16 22:37:23 -0500 |
commit | 7340596de45dc4c0f62a287b6acc4e71d8ee6c60 (patch) | |
tree | 0a9a46ac944a47ad6aae724eabea43f697d206bf /railties/lib | |
parent | 65b370fe7d11d19dcec202967f9a70a4c040e96c (diff) | |
parent | 40a5ba30fb41eba633106509c5b362761b18d497 (diff) | |
download | rails-7340596de45dc4c0f62a287b6acc4e71d8ee6c60.tar.gz rails-7340596de45dc4c0f62a287b6acc4e71d8ee6c60.tar.bz2 rails-7340596de45dc4c0f62a287b6acc4e71d8ee6c60.zip |
Merge pull request #31901 from Kevinrob/patch-1
Use SuppressedSummaryReporter and Rails::TestUnitReporter only if needed
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/minitest/rails_plugin.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/railties/lib/minitest/rails_plugin.rb b/railties/lib/minitest/rails_plugin.rb index 6901b0bbc8..8b2f15a842 100644 --- a/railties/lib/minitest/rails_plugin.rb +++ b/railties/lib/minitest/rails_plugin.rb @@ -43,10 +43,19 @@ module Minitest Minitest.backtrace_filter = ::Rails.backtrace_cleaner if ::Rails.respond_to?(:backtrace_cleaner) end + self.plugin_rails_replace_reporters(reporter, options) + end + + def self.plugin_rails_replace_reporters(minitest_reporter, options) + return unless minitest_reporter.kind_of?(Minitest::CompositeReporter) + # Replace progress reporter for colors. - reporter.reporters.delete_if { |reporter| reporter.kind_of?(SummaryReporter) || reporter.kind_of?(ProgressReporter) } - reporter << SuppressedSummaryReporter.new(options[:io], options) - reporter << ::Rails::TestUnitReporter.new(options[:io], options) + if minitest_reporter.reporters.reject! { |reporter| reporter.kind_of?(SummaryReporter) } != nil + minitest_reporter << SuppressedSummaryReporter.new(options[:io], options) + end + if minitest_reporter.reporters.reject! { |reporter| reporter.kind_of?(ProgressReporter) } != nil + minitest_reporter << ::Rails::TestUnitReporter.new(options[:io], options) + end end # Backwardscompatibility with Rails 5.0 generated plugin test scripts |