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:



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

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



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

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



987
988
989
# File 'lib/minitest.rb', line 987

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



980
981
982
# File 'lib/minitest.rb', line 980

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


991
992
993
# File 'lib/minitest.rb', line 991

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

#prerecord(klass, name) ⇒ Object

:nodoc:



999
1000
1001
1002
1003
1004
# File 'lib/minitest.rb', line 999

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:



1006
1007
1008
1009
1010
# File 'lib/minitest.rb', line 1006

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

#reportObject

:nodoc:



1012
1013
1014
# File 'lib/minitest.rb', line 1012

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

#startObject

:nodoc:



995
996
997
# File 'lib/minitest.rb', line 995

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