assert_equal arg1 (anything), arg2 (anything)
Raises an exception if both arguments aren’t equal.
Introduced in v2.8
assert_equal 1, 1
# Simple assertions
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
assert_equal 3, 5, "something is seriously wrong!"
# Add messages to the exceptions