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:


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

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.


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

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.


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

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:


778
779
780
# File 'lib/minitest.rb', line 778

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)

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

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

#prerecord(klass, name) ⇒ Object

:nodoc:


797
798
799
800
801
802
# File 'lib/minitest.rb', line 797

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:


804
805
806
807
808
# File 'lib/minitest.rb', line 804

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

#reportObject

:nodoc:


810
811
812
# File 'lib/minitest.rb', line 810

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

#startObject

:nodoc:


793
794
795
# File 'lib/minitest.rb', line 793

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