Parent

Minitest::Reporter

Collects and reports the result of all runs.

Attributes

assertions[RW]

The count of assertions run.

count[RW]

The count of runnable methods ran.

io[RW]

The IO used to report.

options[RW]

Command-line options for this run.

results[RW]

The results of all the runs. (Non-passing only to cut down on memory)

start_time[RW]

The start time of the run.

Public Instance Methods

passed?() click to toggle source

Did this run pass?

# File lib/minitest.rb, line 413
def passed?
  results.all?(&:skipped?)
end
record(result) click to toggle source

Record a result and output the Runnable#result_code. Stores the result of the run if the run did not pass.

# File lib/minitest.rb, line 449
def record result
  self.count += 1
  self.assertions += result.assertions

  io.print "%s#%s = %.2f s = " % [result.class, result.name, result.time] if
    options[:verbose]
  io.print result.result_code
  io.puts if options[:verbose]

  results << result if not result.passed? or result.skipped?
end
Also aliased as: simple_record
report() click to toggle source

Outputs the summary of the run.

# File lib/minitest.rb, line 464
def report
  aggregate = results.group_by { |r| r.failure.class }
  aggregate.default = [] # dumb. group_by should provide this

  f = aggregate[Assertion].size
  e = aggregate[UnexpectedError].size
  s = aggregate[Skip].size
  t = Time.now - start_time

  io.puts # finish the dots
  io.puts
  io.puts "Finished in %.6fs, %.4f runs/s, %.4f assertions/s." %
    [t, count / t, self.assertions / t]

  format = "%d runs, %d assertions, %d failures, %d errors, %d skips"
  summary = format % [count, self.assertions, f, e, s]

  io.print self
  io.puts
  io.puts summary
end
run_and_report() click to toggle source

Top-level method to ensure that start and report are called. Yields to the caller.

# File lib/minitest.rb, line 421
def run_and_report
  start

  yield

  io.sync = self.old_sync if self.sync
  report
end
simple_record(result) click to toggle source
Alias for: record
start() click to toggle source

Starts reporting on the run.

# File lib/minitest.rb, line 433
def start
  self.sync = io.respond_to? :"sync=" # stupid emacs
  self.old_sync, io.sync = io.sync, true if self.sync

  self.start_time = Time.now

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.