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:



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

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



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

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



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

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



898
899
900
# File 'lib/minitest.rb', line 898

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


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

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

#prerecord(klass, name) ⇒ Object

:nodoc:



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

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:



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

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

#reportObject

:nodoc:



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

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

#startObject

:nodoc:



913
914
915
# File 'lib/minitest.rb', line 913

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