Class: Minitest::TestResult
- Inherits:
-
Object
- Object
- Minitest::TestResult
- Defined in:
- lib/minitap/minitest5.rb
Overview
TestResult delegtes to Minitest’s own test result object.
Instance Method Summary collapse
-
#assertions ⇒ Object
Number of assertions made by test.
- #exception ⇒ Object
-
#initialize(result) ⇒ TestResult
constructor
Create new TestResult instance.
- #label ⇒ Object
-
#name ⇒ Object
(also: #test)
Name of the test.
-
#spec? ⇒ Boolean
Is this a Minitest::Spec?.
- #test_case ⇒ Object (also: #testcase)
- #time ⇒ Object
-
#type ⇒ Object
Result type.
Constructor Details
#initialize(result) ⇒ TestResult
Create new TestResult instance.
result - MiniTest’s test result object.
644 645 646 |
# File 'lib/minitap/minitest5.rb', line 644 def initialize(result) @result = result end |
Instance Method Details
#assertions ⇒ Object
Number of assertions made by test.
Returns [Integer].
681 682 683 |
# File 'lib/minitap/minitest5.rb', line 681 def assertions @result.assertions end |
#exception ⇒ Object
691 692 693 |
# File 'lib/minitap/minitest5.rb', line 691 def exception @result.failure end |
#label ⇒ Object
660 661 662 663 664 665 666 |
# File 'lib/minitap/minitest5.rb', line 660 def label if spec? name.sub(/^test_\d+_/, '').gsub('_', ' ') else name end end |
#name ⇒ Object Also known as: test
Name of the test.
654 655 656 |
# File 'lib/minitap/minitest5.rb', line 654 def name @result.name end |
#spec? ⇒ Boolean
Is this a Minitest::Spec?
Returns [Boolean].
671 672 673 674 675 676 |
# File 'lib/minitap/minitest5.rb', line 671 def spec? @is_spec ||= ( Minitest.const_defined?(:Spec) && @result.class < Minitest::Spec #@result.class.methods.include?(:it) || @result.class.methods.include?('it') ) end |
#test_case ⇒ Object Also known as: testcase
648 649 650 |
# File 'lib/minitap/minitest5.rb', line 648 def test_case @result.class end |
#time ⇒ Object
686 687 688 |
# File 'lib/minitap/minitest5.rb', line 686 def time @result.time end |
#type ⇒ Object
Result type.
696 697 698 699 700 701 702 703 704 705 706 707 708 709 |
# File 'lib/minitap/minitest5.rb', line 696 def type case exception when UnexpectedError :err when Skip :skip when Assertion :fail when nil :pass else :err end end |