Class: Minitest::SummaryReporter

Inherits:
StatisticsReporter show all
Defined in:
lib/minitest.rb,
lib/spec.rb

Overview

A reporter that prints the header, summary, and failure details at the end of the run.

This is added to the top-level CompositeReporter at the start of the run. If you want to change the output of minitest via a plugin, pull this out of the composite and replace it with your own.

Instance Attribute Summary collapse

Attributes inherited from StatisticsReporter

#assertions, #count, #errors, #failures, #results, #skips, #start_time, #total_time

Attributes inherited from Reporter

#io, #options

Instance Method Summary collapse

Methods inherited from StatisticsReporter

#initialize, #passed?, #record

Methods inherited from Reporter

#initialize

Methods inherited from AbstractReporter

#passed?, #record

Constructor Details

This class inherits a constructor from Minitest::StatisticsReporter

Instance Attribute Details

#old_syncObject

Returns the value of attribute old_sync.



529
530
531
# File 'lib/minitest.rb', line 529

def old_sync
  @old_sync
end

#syncObject

:stopdoc:



528
529
530
# File 'lib/minitest.rb', line 528

def sync
  @sync
end

Instance Method Details

#aggregated_resultsObject Also known as: to_s

:nodoc:



561
562
563
564
565
566
567
568
# File 'lib/minitest.rb', line 561

def aggregated_results # :nodoc:
  filtered_results = results.dup
  filtered_results.reject!(&:skipped?) unless options[:verbose]

  filtered_results.each_with_index.map do |result, i|
    "\n%3d) %s" % [i+1, result]
  end.join("\n") + "\n"
end

#reportObject

:nodoc:



544
545
546
547
548
549
550
551
552
553
554
# File 'lib/minitest.rb', line 544

def report # :nodoc:
  super

  io.sync = self.old_sync

  io.puts unless options[:verbose] # finish the dots
  io.puts
  io.puts statistics
  io.puts aggregated_results
  io.puts summary
end

#startObject

:startdoc:



140
141
142
143
144
145
# File 'lib/spec.rb', line 140

def start # :nodoc:
  super

  self.sync              = io.respond_to? :"sync=" # stupid emacs
  self.old_sync, io.sync = io.sync, true if self.sync
end

#statisticsObject

:nodoc:



148
149
150
# File 'lib/spec.rb', line 148

def statistics # :nodoc:
  "Finished in #{ChronicDuration.output(total_time.round) || '0s'}"
end

#summaryObject

:nodoc:



572
573
574
575
576
577
578
579
580
# File 'lib/minitest.rb', line 572

def summary # :nodoc:
  extra = ""

  extra = "\n\nYou have skipped tests. Run with --verbose for details." if
    results.any?(&:skipped?) unless options[:verbose] or ENV["MT_NO_SKIP_MSG"]

  "%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
    [count, assertions, failures, errors, skips, extra]
end