Ensure arg is not valid
assert_not arg (anything)
Raises an exception if the argument is not either nil or false.
Introduced in v3.3
Examples
# Example 1 |
assert_not false
assert_not nil
assert_not 1 == 5
assert true
|
# Simple assertions
# As false is either nil or false, this assertion passes
# As nil is either nil or false, this assertion passes
# These numbers are not equal
# This will raise an exception
|
# Example 2 |
assert_not true , "oops"
|
# Communicating error messages
# This will raise an exception containing the message "oops"
|