123456789_123456789_123456789_123456789_123456789_

Class: Minitest::Result

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Runnable
Instance Chain:
Inherits: Minitest::Runnable
Defined in: lib/minitest.rb

Overview

This represents a test result in a clean way that can be marshalled over a wire. Tests can do anything they want to the test instance and can create conditions that cause Marshal.dump to blow up. By using Result.from(a_test) you can be reasonably sure that the test result can be marshalled.

Class Method Summary

Runnable - Inherited

.methods_matching

Returns all instance methods matching the pattern re.

.run

Responsible for running all runnable methods in a given class, each in its own instance.

.run_one_method

Runs a single method and has the reporter record the result.

.runnable_methods

Each subclass of Runnable is responsible for overriding this method to return all runnable methods.

.runnables

Returns all subclasses of Runnable.

Instance Attribute Summary

Reportable - Included

#error?

Did this run error?

#passed?

Did this run pass?

#skipped?

Was this run skipped?

Runnable - Inherited

#assertions

Number of assertions executed in this run.

#failures

An assertion raised during the run, if any.

#name

Name of the run.

#name=

Set the name of the run.

#time

The time it took to run.

#passed?

Did this run pass?

#skipped?

Was this run skipped? See #passed? for more information.

Instance Method Summary

Reportable - Included

#location

The location identifier of this test.

#result_code

Returns “.”, “F”, or “E” based on the result of the run.

Runnable - Inherited

#result_code

Returns a single character string to print based on the result of the run.

#run

Runs a single method.

Class Method Details

.from(runnable)

Create a new test result from a Runnable instance.

[ GitHub ]

  
# File 'lib/minitest.rb', line 523

def self.from runnable
  o = runnable

  r = self.new o.name
  r.klass      = o.class.name
  r.assertions = o.assertions
  r.failures   = o.failures.dup
  r.time       = o.time

  r.source_location = o.method(o.name).source_location rescue ["unknown", -1]

  r
end

Instance Attribute Details

#klass (rw)

The class name of the test result.

[ GitHub ]

  
# File 'lib/minitest.rb', line 513

attr_accessor :klass

#source_location (rw)

The location of the test method.

[ GitHub ]

  
# File 'lib/minitest.rb', line 518

attr_accessor :source_location