Class: Maze::Checks::AssertCheck

Inherits:
Object
  • Object
show all
Includes:
Test::Unit::Assertions
Defined in:
lib/maze/checks/assert_check.rb

Overview

Assertion-backed data verification checks

Instance Method Summary collapse

Instance Method Details

#block(message = 'block failed', &block) ⇒ Object



54
55
56
# File 'lib/maze/checks/assert_check.rb', line 54

def block(message = 'block failed', &block)
  assert_block(message, &block)
end

#equal(expected, act, message = nil) ⇒ Object



38
39
40
# File 'lib/maze/checks/assert_check.rb', line 38

def equal(expected, act, message = nil)
  assert_equal(expected, act, message)
end

#false(test, message = nil) ⇒ Object



14
15
16
# File 'lib/maze/checks/assert_check.rb', line 14

def false(test, message = nil)
  assert_false(test, message)
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, message = nil)
  assert_include(collection, object, message)
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, message = nil)
  assert_kind_of(klass, object, message)
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, message = nil)
  regexp = if pattern.class == Regexp
             pattern
           else
             Regexp.new(pattern)
           end
  if message.nil?
    message = "<#{string}> was not matched by regex <#{pattern}>"
  end
  assert_match(regexp, string, message)
end

#nil(test, message = nil) ⇒ Object



18
19
20
# File 'lib/maze/checks/assert_check.rb', line 18

def nil(test, message = nil)
  assert_nil(test, message)
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, message = nil)
  assert_not_equal(expected, act, message)
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, message = nil)
  assert_not_include(collection, object, message)
end

#not_nil(test, message = nil) ⇒ Object



22
23
24
# File 'lib/maze/checks/assert_check.rb', line 22

def not_nil(test, message = nil)
  assert_not_nil(test, message)
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, message = nil)
  assert_operator(operand1, operator, operand2, message)
end

#true(test, message = nil) ⇒ Object



10
11
12
# File 'lib/maze/checks/assert_check.rb', line 10

def true(test, message = nil)
  assert_true(test, message)
end