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:



753
754
755
756
# File 'lib/minitest.rb', line 753

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

Instance Attribute Details

#reportersObject

The list of reporters to dispatch to.



751
752
753
# File 'lib/minitest.rb', line 751

def reporters
  @reporters
end

Instance Method Details

#<<(reporter) ⇒ Object

Add another reporter to the mix.



765
766
767
# File 'lib/minitest.rb', line 765

def << reporter
  self.reporters << reporter
end

#ioObject

:nodoc:



758
759
760
# File 'lib/minitest.rb', line 758

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

#passed?Boolean

:nodoc:

Returns:

  • (Boolean)


769
770
771
# File 'lib/minitest.rb', line 769

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

#prerecord(klass, name) ⇒ Object

:nodoc:



777
778
779
780
781
782
# File 'lib/minitest.rb', line 777

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:



784
785
786
787
788
# File 'lib/minitest.rb', line 784

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

#reportObject

:nodoc:



790
791
792
# File 'lib/minitest.rb', line 790

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

#startObject

:nodoc:



773
774
775
# File 'lib/minitest.rb', line 773

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