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:


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

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.


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

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.


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

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:


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

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)

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

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

#prerecord(klass, name) ⇒ Object

:nodoc:


874
875
876
877
878
879
# File 'lib/minitest.rb', line 874

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:


881
882
883
884
885
# File 'lib/minitest.rb', line 881

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

#reportObject

:nodoc:


887
888
889
# File 'lib/minitest.rb', line 887

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

#startObject

:nodoc:


870
871
872
# File 'lib/minitest.rb', line 870

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