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:


940
941
942
943
# File 'lib/minitest.rb', line 940

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.


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

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.


952
953
954
# File 'lib/minitest.rb', line 952

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:


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

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)

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

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

#prerecord(klass, name) ⇒ Object

:nodoc:


964
965
966
967
968
969
# File 'lib/minitest.rb', line 964

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:


971
972
973
974
975
# File 'lib/minitest.rb', line 971

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

#reportObject

:nodoc:


977
978
979
# File 'lib/minitest.rb', line 977

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

#startObject

:nodoc:


960
961
962
# File 'lib/minitest.rb', line 960

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