Class: TestHelper
- Inherits:
-
Object
- Object
- TestHelper
- Defined in:
- lib/test_helper.rb
Overview
The methods in this class are available whenever you’re in a tests do … end block.
Instance Attribute Summary collapse
-
#fuzz ⇒ Object
The method being tested.
-
#method ⇒ Object
The method being tested.
Instance Method Summary collapse
- #assert(some_statement, description = '') ⇒ Object
- #assert_divisible_by(lhs, rhs, description = '') ⇒ Object
- #assert_equal(lhs, rhs, description = '') ⇒ Object
- #assert_greater_than(lhs, rhs, description = '') ⇒ Object
- #assert_less_than(lhs, rhs, description = '') ⇒ Object
- #assert_not_equal(lhs, rhs, description = '') ⇒ Object
Instance Attribute Details
#fuzz ⇒ Object
The method being tested
3 4 5 |
# File 'lib/test_helper.rb', line 3 def fuzz @fuzz end |
#method ⇒ Object
The method being tested
3 4 5 |
# File 'lib/test_helper.rb', line 3 def method @method end |
Instance Method Details
#assert(some_statement, description = '') ⇒ Object
5 6 7 8 9 10 |
# File 'lib/test_helper.rb', line 5 def assert(some_statement, description = '') passed = !!some_statement raise InlineTestFailure.new('assert', some_statement, nil, description) unless passed passed end |
#assert_divisible_by(lhs, rhs, description = '') ⇒ Object
40 41 42 43 44 45 |
# File 'lib/test_helper.rb', line 40 def assert_divisible_by(lhs, rhs, description = '') passed = !!flexible_assert(lhs, rhs, "[lhs] % [rhs] == 0") raise InlineTestFailure.new('assert_divisible_by', lhs, rhs, description) unless passed passed end |
#assert_equal(lhs, rhs, description = '') ⇒ Object
12 13 14 15 16 17 |
# File 'lib/test_helper.rb', line 12 def assert_equal(lhs, rhs, description = '') passed = !!flexible_assert(lhs, rhs, "[lhs] == [rhs]") raise InlineTestFailure.new('assert_equal', lhs, rhs, description) unless passed passed end |
#assert_greater_than(lhs, rhs, description = '') ⇒ Object
33 34 35 36 37 38 |
# File 'lib/test_helper.rb', line 33 def assert_greater_than(lhs, rhs, description = '') passed = !!flexible_assert(lhs, rhs, "[lhs] > [rhs]") raise InlineTestFailure.new('assert_greater_than', lhs, rhs, description) unless passed passed end |
#assert_less_than(lhs, rhs, description = '') ⇒ Object
26 27 28 29 30 31 |
# File 'lib/test_helper.rb', line 26 def assert_less_than(lhs, rhs, description = '') passed = !!flexible_assert(lhs, rhs, "[lhs] < [rhs]") raise InlineTestFailure.new('assert_less_than', lhs, rhs, description) unless passed passed end |
#assert_not_equal(lhs, rhs, description = '') ⇒ Object
19 20 21 22 23 24 |
# File 'lib/test_helper.rb', line 19 def assert_not_equal(lhs, rhs, description = '') passed = !!flexible_assert(lhs, rhs, "[lhs] != [rhs]") raise InlineTestFailure.new('assert_not_equal', lhs, rhs, description) unless passed passed end |