Class: MiniAssert::TestCase
- Inherits:
-
Object
- Object
- MiniAssert::TestCase
- Includes:
- Assertable
- Defined in:
- lib/mini_assert/test_case.rb
Overview
Basic test case object
Instance Attribute Summary collapse
-
#passed_tests ⇒ Object
readonly
Returns the value of attribute passed_tests.
-
#total_tests ⇒ Object
readonly
Returns the value of attribute total_tests.
Instance Method Summary collapse
- #each_test! ⇒ Object
-
#initialize ⇒ TestCase
constructor
A new instance of TestCase.
Methods included from Assertable
#assert, #assert_equal, #assert_exception
Constructor Details
#initialize ⇒ TestCase
Returns a new instance of TestCase.
10 11 12 13 |
# File 'lib/mini_assert/test_case.rb', line 10 def initialize @total_tests = testable_methods.size @passed_tests = 0 end |
Instance Attribute Details
#passed_tests ⇒ Object (readonly)
Returns the value of attribute passed_tests.
8 9 10 |
# File 'lib/mini_assert/test_case.rb', line 8 def passed_tests @passed_tests end |
#total_tests ⇒ Object (readonly)
Returns the value of attribute total_tests.
8 9 10 |
# File 'lib/mini_assert/test_case.rb', line 8 def total_tests @total_tests end |
Instance Method Details
#each_test! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mini_assert/test_case.rb', line 15 def each_test! testable_methods.each do |testable_method| begin public_send testable_method @passed_tests += 1 rescue MiniAssert::AssertionError => e file_name, method_line = method(testable_method).source_location yield("#{file_name}:#{method_line} #{e}") if block_given? end end end |