module MiniAssert::Assertable
Assertion methods
Public Instance Methods
assert(expression, message = 'Expected a truthy value')
click to toggle source
# File lib/mini_assert/assertable.rb, line 8 def assert(expression, message = 'Expected a truthy value') raise AssertionError, message unless expression end
assert_equal(expected, value)
click to toggle source
# File lib/mini_assert/assertable.rb, line 12 def assert_equal(expected, value) assert(expected == value, "Expected #{expected.inspect} to equal #{value.inspect}") end
assert_exception(exception) { || ... }
click to toggle source
# File lib/mini_assert/assertable.rb, line 16 def assert_exception(exception) yield assert(false, "Expected #{exception} but nothing was raised") rescue => e assert(e.class == exception, "Expected #{exception} got #{e.class}") end