Class: Spec::Matchers::Eql

Inherits:
Object show all
Defined in:
lib/spec/matchers/eql.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ Eql

Returns a new instance of Eql.



5
6
7
# File 'lib/spec/matchers/eql.rb', line 5

def initialize(expected)
  @expected = expected
end

Instance Method Details

#descriptionObject



22
23
24
# File 'lib/spec/matchers/eql.rb', line 22

def description
  "eql #{@expected.inspect}"
end

#failure_messageObject



14
15
16
# File 'lib/spec/matchers/eql.rb', line 14

def failure_message
  return "expected #{@expected.inspect}, got #{@actual.inspect} (using .eql?)", @expected, @actual
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/spec/matchers/eql.rb', line 9

def matches?(actual)
  @actual = actual
  @actual.eql?(@expected)
end

#negative_failure_messageObject



18
19
20
# File 'lib/spec/matchers/eql.rb', line 18

def negative_failure_message
  return "expected #{@actual.inspect} not to equal #{@expected.inspect} (using .eql?)", @expected, @actual
end