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:



890
891
892
893
# File 'lib/minitest.rb', line 890

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



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

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



902
903
904
# File 'lib/minitest.rb', line 902

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



895
896
897
# File 'lib/minitest.rb', line 895

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


906
907
908
# File 'lib/minitest.rb', line 906

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

#prerecord(klass, name) ⇒ Object

:nodoc:



914
915
916
917
918
919
# File 'lib/minitest.rb', line 914

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:



921
922
923
924
925
# File 'lib/minitest.rb', line 921

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

#reportObject

:nodoc:



927
928
929
# File 'lib/minitest.rb', line 927

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

#startObject

:nodoc:



910
911
912
# File 'lib/minitest.rb', line 910

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