Class: Minitest::CompositeReporter

Inherits:
AbstractReporter show all
Defined in:
lib/minitest.rb

Overview

Dispatch to multiple reporters as one.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*reporters) ⇒ CompositeReporter

:nodoc:


828
829
830
831
# File 'lib/minitest.rb', line 828

def initialize *reporters # :nodoc:
  super()
  self.reporters = reporters
end

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.


826
827
828
# File 'lib/minitest.rb', line 826

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.


840
841
842
# File 'lib/minitest.rb', line 840

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:


833
834
835
# File 'lib/minitest.rb', line 833

def io # :nodoc:
  reporters.first.io
end

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)

844
845
846
# File 'lib/minitest.rb', line 844

def passed? # :nodoc:
  self.reporters.all?(&:passed?)
end

#prerecord(klass, name) ⇒ Object

:nodoc:


852
853
854
855
856
857
# File 'lib/minitest.rb', line 852

def prerecord klass, name # :nodoc:
  self.reporters.each do |reporter|
    # TODO: remove conditional for minitest 6
    reporter.prerecord klass, name if reporter.respond_to? :prerecord
  end
end

#record(result) ⇒ Object

:nodoc:


859
860
861
862
863
# File 'lib/minitest.rb', line 859

def record result # :nodoc:
  self.reporters.each do |reporter|
    reporter.record result
  end
end

#reportObject

:nodoc:


865
866
867
# File 'lib/minitest.rb', line 865

def report # :nodoc:
  self.reporters.each(&:report)
end

#startObject

:nodoc:


848
849
850
# File 'lib/minitest.rb', line 848

def start # :nodoc:
  self.reporters.each(&:start)
end