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:



649
650
651
652
# File 'lib/minitest.rb', line 649

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



647
648
649
# File 'lib/minitest.rb', line 647

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



661
662
663
# File 'lib/minitest.rb', line 661

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



654
655
656
# File 'lib/minitest.rb', line 654

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


665
666
667
# File 'lib/minitest.rb', line 665

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

#prerecord(klass, name) ⇒ Object

:nodoc:



673
674
675
676
677
678
# File 'lib/minitest.rb', line 673

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:



680
681
682
683
684
# File 'lib/minitest.rb', line 680

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

#reportObject

:nodoc:



686
687
688
# File 'lib/minitest.rb', line 686

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

#startObject

:nodoc:



669
670
671
# File 'lib/minitest.rb', line 669

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