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:



770
771
772
773
# File 'lib/minitest.rb', line 770

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



768
769
770
# File 'lib/minitest.rb', line 768

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



782
783
784
# File 'lib/minitest.rb', line 782

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



775
776
777
# File 'lib/minitest.rb', line 775

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


786
787
788
# File 'lib/minitest.rb', line 786

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

#prerecord(klass, name) ⇒ Object

:nodoc:



794
795
796
797
798
799
# File 'lib/minitest.rb', line 794

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:



801
802
803
804
805
# File 'lib/minitest.rb', line 801

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

#reportObject

:nodoc:



807
808
809
# File 'lib/minitest.rb', line 807

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

#startObject

:nodoc:



790
791
792
# File 'lib/minitest.rb', line 790

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