Module: Minitest::Reportable
Overview
Shared code for anything that can get passed to a Reporter. See Minitest::Test & Minitest::Result.
Instance Method Summary collapse
-
#class_name ⇒ Object
:nodoc:.
-
#error? ⇒ Boolean
Did this run error?.
-
#location ⇒ Object
The location identifier of this test.
-
#passed? ⇒ Boolean
Did this run pass?.
-
#result_code ⇒ Object
Returns “.”, “F”, or “E” based on the result of the run.
-
#skipped? ⇒ Boolean
Was this run skipped?.
Instance Method Details
#class_name ⇒ Object
:nodoc:
469 470 471 |
# File 'lib/minitest.rb', line 469 def class_name # :nodoc: raise NotImplementedError, "subclass responsibility" end |
#error? ⇒ Boolean
Did this run error?
490 491 492 |
# File 'lib/minitest.rb', line 490 def error? self.failures.any? { |f| UnexpectedError === f } end |
#location ⇒ Object
The location identifier of this test. Depends on a method existing called class_name.
464 465 466 467 |
# File 'lib/minitest.rb', line 464 def location loc = " [#{self.failure.location}]" unless passed? or error? "#{self.class_name}##{self.name}#{loc}" end |
#passed? ⇒ Boolean
Did this run pass?
Note: skipped runs are not considered passing, but they don’t cause the process to exit non-zero.
456 457 458 |
# File 'lib/minitest.rb', line 456 def passed? not self.failure end |
#result_code ⇒ Object
Returns “.”, “F”, or “E” based on the result of the run.
476 477 478 |
# File 'lib/minitest.rb', line 476 def result_code self.failure and self.failure.result_code or "." end |
#skipped? ⇒ Boolean
Was this run skipped?
483 484 485 |
# File 'lib/minitest.rb', line 483 def skipped? self.failure and Skip === self.failure end |