Class: Truenames::Matchers::ExprEq

Inherits:
RSpec::Matchers::BuiltIn::Eq
  • Object
show all
Defined in:
lib/truenames/matchers/expr_eq.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected = nil) ⇒ ExprEq

Returns a new instance of ExprEq.



11
12
13
14
15
16
# File 'lib/truenames/matchers/expr_eq.rb', line 11

def initialize(expected = nil)
  @expected = expected

  # One to escape this binding, one to escape the Truenames::Matchers#expr_eq wrapper method
  @binding = binding.of_caller(2)
end

Instance Method Details

#failure_message_for_shouldObject



22
23
24
25
# File 'lib/truenames/matchers/expr_eq.rb', line 22

def failure_message_for_should
  "\nexpected: #{expected.inspect}#{inspect_references_for(expected)}\n" +
    "     got: #{actual.inspect}#{inspect_references_for(actual)}\n\n(compared using ==)\n"
end

#nameObject



18
19
20
# File 'lib/truenames/matchers/expr_eq.rb', line 18

def name
  "eq"
end