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