Class: Minitest::Result
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Runnable
|
|
Instance Chain:
self,
Reportable ,
Runnable
|
|
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 .from(a_test) you can be reasonably sure that the test result can be marshalled.
Constant Summary
Class Method Summary
-
.from(runnable)
Create a new test result from a
Runnable
instance.
Runnable
- Inherited
.methods_matching | Returns all instance methods matching the pattern |
.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 |
.runnables | Returns all subclasses of |
.inherited, .new, .on_signal, .reset, .with_info_handler |
Instance Attribute Summary
-
#klass
rw
The class name of the test result.
-
#source_location
rw
The location of the test method.
Reportable
- Included
Runnable
- Inherited
Instance Method Summary
- #class_name Internal use only
- #to_s Internal use only
Reportable
- Included
#location | The location identifier of this test. |
#result_code | Returns “.”, “F”, or “E” based on the result of the run. |
#class_name |
Runnable
- Inherited
#result_code | Returns a single character string to print based on the result of the run. |
#run | Runs a single method. |
#failure, #marshal_dump, #marshal_load, #time_it |
Constructor Details
This class inherits a constructor from Minitest::Runnable
Class Method Details
.from(runnable)
Create a new test result from a Runnable
instance.
# File 'lib/minitest.rb', line 521
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.
# File 'lib/minitest.rb', line 511
attr_accessor :klass
#source_location (rw)
The location of the test method.
# File 'lib/minitest.rb', line 516
attr_accessor :source_location
Instance Method Details
#class_name
# File 'lib/minitest.rb', line 535
def class_name # :nodoc: self.klass # for Minitest::Reportable end
#to_s
# File 'lib/minitest.rb', line 539
def to_s # :nodoc: return location if passed? and not skipped? failures.map { |failure| "#{failure.result_label}:\n#{self.location}:\n#{failure.}\n" }.join "\n" end