1class EqlMatcher
2  def initialize(expected)
3    @expected = expected
4  end
5
6  def matches?(actual)
7    @actual = actual
8    @actual.eql?(@expected)
9  end
10
11  def failure_message
12    ["Expected #{@actual.pretty_inspect}",
13     "to have same value and type as #{@expected.pretty_inspect}"]
14  end
15
16  def negative_failure_message
17    ["Expected #{@actual.pretty_inspect}",
18     "not to have same value or type as #{@expected.pretty_inspect}"]
19  end
20end
21
22module MSpecMatchers
23  private def eql(expected)
24    EqlMatcher.new(expected)
25  end
26end
27