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

Methods inherited from AbstractReporter

#synchronize

Constructor Details

#initialize(*reporters) ⇒ CompositeReporter

:nodoc:



918
919
920
921
# File 'lib/minitest.rb', line 918

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



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

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



930
931
932
# File 'lib/minitest.rb', line 930

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



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

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


934
935
936
# File 'lib/minitest.rb', line 934

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

#prerecord(klass, name) ⇒ Object

:nodoc:



942
943
944
945
946
947
# File 'lib/minitest.rb', line 942

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:



949
950
951
952
953
# File 'lib/minitest.rb', line 949

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

#reportObject

:nodoc:



955
956
957
# File 'lib/minitest.rb', line 955

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

#startObject

:nodoc:



938
939
940
# File 'lib/minitest.rb', line 938

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