Ensure args are equal

assert_equal  arg1 (anything), arg2 (anything)

Raises an exception if both arguments aren’t equal.

Introduced in v2.8

Examples

# Example 1


assert_equal 1, 1



# Simple assertions
 



# Example 2


assert_equal 1 + 1, 2
assert_equal [:a, :b, :c].size,  3



# More interesting assertions
# Ensure that arithmetic is sane!
# ensure lists can be correctly counted



# Example 3


assert_equal 3, 5, "something is seriously wrong!"



# Add messages to the exceptions