Class: EqualMatcher

Inherits:
Object show all
Defined in:
lib/mspec/matchers/equal.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ EqualMatcher


2
3
4
# File 'lib/mspec/matchers/equal.rb', line 2

def initialize(expected)
  @expected = expected
end

Instance Method Details

#failure_messageObject


11
12
13
14
# File 'lib/mspec/matchers/equal.rb', line 11

def failure_message
  ["Expected #{@actual.pretty_inspect}",
   "to be identical to #{@expected.pretty_inspect}"]
end

#matches?(actual) ⇒ Boolean


6
7
8
9
# File 'lib/mspec/matchers/equal.rb', line 6

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

#negative_failure_messageObject


16
17
18
19
# File 'lib/mspec/matchers/equal.rb', line 16

def negative_failure_message
  ["Expected #{@actual.pretty_inspect}",
   "not to be identical to #{@expected.pretty_inspect}"]
end