assert_equal(expected, actual, message=nil) public

Passes if expected == +actual.

Note that the ordering of arguments is important, since a helpful error message is generated when this one fails that tells you the values of expected and actual.

Example:

  assert_equal 'MY STRING', 'my string'.upcase
Show source
Register or log in to add new notes.
July 14, 2009
2 thanks

Not for floats

You should use assert_in_delta when comparing floating-point numbers.