Rewrite aggregated results suppression.

I should have replaced the summary reporter with a subclass
the first time I wrote this.

For whatever reason, I didn't. Do it right and slim the methods added
to Minitest in the process.
This commit is contained in:
Kasper Timm Hansen 2015-12-23 23:18:58 +01:00
parent b99e7297e7
commit 33804c7d0f

@ -3,16 +3,13 @@
require "rails/test_unit/test_requirer"
module Minitest
mattr_accessor(:hide_aggregated_results) { false }
module AggregatedResultSuppresion
class SuppressedSummaryReporter < SummaryReporter
# Disable extra failure output after a run if output is inline.
def aggregated_results
super unless Minitest.hide_aggregated_results
super unless options[:output_inline]
end
end
SummaryReporter.prepend AggregatedResultSuppresion
def self.plugin_rails_options(opts, options)
executable = ::Rails::TestUnitReporter.executable
opts.separator ""
@ -83,11 +80,8 @@ def self.plugin_rails_init(options)
Minitest.backtrace_filter = ::Rails.backtrace_cleaner if ::Rails.respond_to?(:backtrace_cleaner)
end
# Disable the extra failure output after a run, unless output is deferred.
self.hide_aggregated_results = options[:output_inline]
self.reporter.reporters.clear # Replace progress reporter for colors.
self.reporter << SummaryReporter.new(options[:io], options)
self.reporter << SuppressedSummaryReporter.new(options[:io], options)
self.reporter << ::Rails::TestUnitReporter.new(options[:io], options)
end