Module: Minitest::HashDiffAssertions

Defined in:
lib/minitest/hashdiff.rb

Overview

Prepended into Minitest::Assertions so assert_equal failures on two hashes show the readable report instead of the default diff.

Instance Method Summary collapse

Instance Method Details

#diff(exp, act) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/minitest/hashdiff.rb', line 71

def diff(exp, act)
  if exp.is_a?(Hash) && act.is_a?(Hash) && exp != act
    Minitest::HashDiff.format(exp, act) || super
  else
    super
  end
end