Class: Minitest::SummaryReporter

Inherits:
StatisticsReporter show all
Defined in:
lib/minitest.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, #record, #simple_record, synchronize

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.



502
503
504
# File 'lib/minitest.rb', line 502

def old_sync
  @old_sync
end

#syncObject

:stopdoc:



501
502
503
# File 'lib/minitest.rb', line 501

def sync
  @sync
end

Instance Method Details

#aggregated_resultsObject

:nodoc:



534
535
536
537
538
539
540
541
# File 'lib/minitest.rb', line 534

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:



517
518
519
520
521
522
523
524
525
526
527
# File 'lib/minitest.rb', line 517

def report # :nodoc:
  super

  io.sync = self.old_sync

  io.puts # finish the dots
  io.puts
  io.puts statistics
  io.puts aggregated_results
  io.puts summary
end

#startObject

:startdoc:



505
506
507
508
509
510
511
512
513
514
515
# File 'lib/minitest.rb', line 505

def start # :nodoc:
  super

  io.puts "Run options: #{options[:args]}"
  io.puts
  io.puts "# Running:"
  io.puts

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

#statisticsObject

:nodoc:



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

def statistics # :nodoc:
  "Finished in %.6fs, %.4f runs/s, %.4f assertions/s." %
    [total_time, count / total_time, assertions / total_time]
end

#summaryObject

:nodoc:



543
544
545
546
# File 'lib/minitest.rb', line 543

def summary # :nodoc:
  "%d runs, %d assertions, %d failures, %d errors, %d skips" %
    [count, assertions, failures, errors, skips]
end