class RSpec::Matchers::BuiltIn::Equal

Public Instance Methods

diffable?() click to toggle source
# File lib/rspec/matchers/built_in/equal.rb, line 34
def diffable?; true; end
failure_message_for_should() click to toggle source
# File lib/rspec/matchers/built_in/equal.rb, line 9
        def failure_message_for_should
          return <<-MESSAGE

expected #{inspect_object(expected)}
     got #{inspect_object(actual)}

Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`#{eq_expression}` if you don't care about
object identity in this example.

MESSAGE
        end
failure_message_for_should_not() click to toggle source
# File lib/rspec/matchers/built_in/equal.rb, line 23
        def failure_message_for_should_not
          return <<-MESSAGE

expected not #{inspect_object(actual)}
         got #{inspect_object(expected)}

Compared using equal?, which compares object identity.

MESSAGE
        end
match(expected, actual) click to toggle source
# File lib/rspec/matchers/built_in/equal.rb, line 5
def match(expected, actual)
  actual.equal? expected
end

Private Instance Methods

eq_expression() click to toggle source
# File lib/rspec/matchers/built_in/equal.rb, line 42
def eq_expression
  Expectations::Syntax.positive_expression("actual", "eq(expected)")
end
inspect_object(o) click to toggle source
# File lib/rspec/matchers/built_in/equal.rb, line 38
def inspect_object(o)
  "#<#{o.class}:#{o.object_id}> => #{o.inspect}"
end