Module: Minitest::Reportable
Overview
Shared code for anything that can get passed to a Reporter. See Minitest::Test & Minitest::Result.
Constant Summary collapse
- BASE_DIR =
:nodoc:
"#{Dir.pwd}/"
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
permalink #class_name ⇒ Object
:nodoc:
568 569 570 |
# File 'lib/minitest.rb', line 568 def class_name # :nodoc: raise NotImplementedError, "subclass responsibility" end |
permalink #error? ⇒ Boolean
Did this run error?
589 590 591 |
# File 'lib/minitest.rb', line 589 def error? self.failures.any? { |f| UnexpectedError === f } end |
permalink #location ⇒ Object
The location identifier of this test. Depends on a method existing called class_name.
563 564 565 566 |
# File 'lib/minitest.rb', line 563 def location loc = " [#{self.failure.location.delete_prefix BASE_DIR}]" unless passed? or error? "#{self.class_name}##{self.name}#{loc}" end |
permalink #passed? ⇒ Boolean
Did this run pass?
Note: skipped runs are not considered passing, but they don’t cause the process to exit non-zero.
553 554 555 |
# File 'lib/minitest.rb', line 553 def passed? not self.failure end |
permalink #result_code ⇒ Object
Returns “.”, “F”, or “E” based on the result of the run.
575 576 577 |
# File 'lib/minitest.rb', line 575 def result_code self.failure and self.failure.result_code or "." end |
permalink #skipped? ⇒ Boolean
Was this run skipped?
582 583 584 |
# File 'lib/minitest.rb', line 582 def skipped? self.failure and Skip === self.failure end |