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:



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

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



904
905
906
# File 'lib/minitest.rb', line 904

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



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

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



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

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


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

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

#prerecord(klass, name) ⇒ Object

:nodoc:



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

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:



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

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

#reportObject

:nodoc:



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

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

#startObject

:nodoc:



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

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