Class: Maze::Checks::AssertCheck
- Inherits:
-
Object
- Object
- Maze::Checks::AssertCheck
- Includes:
- Test::Unit::Assertions
- Defined in:
- lib/maze/checks/assert_check.rb
Overview
Assertion-backed data verification checks
Instance Method Summary collapse
- #block(message = 'block failed', &block) ⇒ Object
- #equal(expected, act, message = nil) ⇒ Object
- #false(test, message = nil) ⇒ Object
- #include(collection, object, message = nil) ⇒ Object (also: #includes)
- #kind_of(klass, object, message = nil) ⇒ Object
- #match(pattern, string, message = nil) ⇒ Object
- #nil(test, message = nil) ⇒ Object
- #not_equal(expected, act, message = nil) ⇒ Object
- #not_include(collection, object, message = nil) ⇒ Object (also: #not_includes)
- #not_nil(test, message = nil) ⇒ Object
- #operator(operand1, operator, operand2, message = nil) ⇒ Object
- #true(test, message = nil) ⇒ Object
Instance Method Details
#block(message = 'block failed', &block) ⇒ Object
54 55 56 |
# File 'lib/maze/checks/assert_check.rb', line 54 def block( = 'block failed', &block) assert_block(, &block) end |
#equal(expected, act, message = nil) ⇒ Object
38 39 40 |
# File 'lib/maze/checks/assert_check.rb', line 38 def equal(expected, act, = nil) assert_equal(expected, act, ) end |
#false(test, message = nil) ⇒ Object
14 15 16 |
# File 'lib/maze/checks/assert_check.rb', line 14 def false(test, = nil) assert_false(test, ) end |
#include(collection, object, message = nil) ⇒ Object Also known as: includes
58 59 60 |
# File 'lib/maze/checks/assert_check.rb', line 58 def include(collection, object, = nil) assert_include(collection, object, ) end |
#kind_of(klass, object, message = nil) ⇒ Object
50 51 52 |
# File 'lib/maze/checks/assert_check.rb', line 50 def kind_of(klass, object, = nil) assert_kind_of(klass, object, ) end |
#match(pattern, string, message = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/maze/checks/assert_check.rb', line 26 def match(pattern, string, = nil) regexp = if pattern.class == Regexp pattern else Regexp.new(pattern) end if .nil? = "<#{string}> was not matched by regex <#{pattern}>" end assert_match(regexp, string, ) end |
#nil(test, message = nil) ⇒ Object
18 19 20 |
# File 'lib/maze/checks/assert_check.rb', line 18 def nil(test, = nil) assert_nil(test, ) end |
#not_equal(expected, act, message = nil) ⇒ Object
42 43 44 |
# File 'lib/maze/checks/assert_check.rb', line 42 def not_equal(expected, act, = nil) assert_not_equal(expected, act, ) end |
#not_include(collection, object, message = nil) ⇒ Object Also known as: not_includes
63 64 65 |
# File 'lib/maze/checks/assert_check.rb', line 63 def not_include(collection, object, = nil) assert_not_include(collection, object, ) end |
#not_nil(test, message = nil) ⇒ Object
22 23 24 |
# File 'lib/maze/checks/assert_check.rb', line 22 def not_nil(test, = nil) assert_not_nil(test, ) end |
#operator(operand1, operator, operand2, message = nil) ⇒ Object
46 47 48 |
# File 'lib/maze/checks/assert_check.rb', line 46 def operator(operand1, operator, operand2, = nil) assert_operator(operand1, operator, operand2, ) end |
#true(test, message = nil) ⇒ Object
10 11 12 |
# File 'lib/maze/checks/assert_check.rb', line 10 def true(test, = nil) assert_true(test, ) end |