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:



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

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



822
823
824
# File 'lib/minitest.rb', line 822

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



836
837
838
# File 'lib/minitest.rb', line 836

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



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

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


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

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

#prerecord(klass, name) ⇒ Object

:nodoc:



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

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:



855
856
857
858
859
# File 'lib/minitest.rb', line 855

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

#reportObject

:nodoc:



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

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

#startObject

:nodoc:



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

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