Method: Minitest::Assertions#assert_equal

Defined in:
lib/minitest/assertions.rb

#assert_equal(exp, act, msg = nil) ⇒ Object

Fails unless exp == act printing the difference between the two, if possible.

If there is no visible difference but the assertion fails, you should suspect that your #== is buggy, or your inspect output is missing crucial details. For nicer structural diffing, set Minitest::Test.make_my_diffs_pretty!

For floats use assert_in_delta.

See also: Minitest::Assertions.diff



211
212
213
214
215
216
217
# File 'lib/minitest/assertions.rb', line 211

def assert_equal exp, act, msg = nil
  msg = message(msg, nil) { diff exp, act }

  refute_nil exp, message { "Use assert_nil if expecting nil" } if exp.nil? # don't count

  assert exp == act, msg
end