class Minitest::Result
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 you can be reasonably sure that the test result can be marshalled.
Attributes
klass[RW]
The class name of the test result.
source_location[RW]
The location of the test method.
Public Class Methods
from(runnable)
click to toggle source
Create a new test result from a Runnable instance.
# File lib/minitest.rb, line 463 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
Public Instance Methods
error?()
click to toggle source
Did this run error?
# File lib/minitest.rb, line 480 def error? self.failures.any? { |f| UnexpectedError === f } end
location()
click to toggle source
The location identifier of this test.
# File lib/minitest.rb, line 487 def location loc = " [#{self.failure.location}]" unless passed? or error? "#{self.klass}##{self.name}#{loc}" end
passed?()
click to toggle source
Did this run pass?
Note: skipped runs are not considered passing, but they don't cause the process to exit non-zero.
# File lib/minitest.rb, line 498 def passed? not self.failure end
result_code()
click to toggle source
Returns “.”, “F”, or “E” based on the result of the run.
# File lib/minitest.rb, line 505 def result_code self.failure and self.failure.result_code or "." end
skipped?()
click to toggle source
Was this run skipped?
# File lib/minitest.rb, line 512 def skipped? self.failure and Skip === self.failure end