def equal(expected)
Matcher.new :equal, expected do |_expected_|
match do |actual|
actual.equal?(_expected_)
end
def inspect_object(o)
"#<#{o.class}:#{o.object_id}> => #{o.inspect}"
end
failure_message_for_should do |actual|
"\nexpected \#{inspect_object(_expected_)}\ngot \#{inspect_object(actual)}\n\nCompared using equal?, which compares object identity,\nbut expected and actual are not the same object. Use\n'actual.should == expected' if you don't care about\nobject identity in this example.\n\n"
end
failure_message_for_should_not do |actual|
"\nexpected not \#{inspect_object(actual)}\ngot \#{inspect_object(_expected_)}\n\nCompared using equal?, which compares object identity.\n\n"
end
end
end