blob: ee6431fd4f15fe8c1f962a5ca280ea705574af7a (
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 EqualMatcher
def initialize(expected)
@expected = expected
end
def matches?(actual)
@actual = actual
@actual.equal?(@expected)
end
def failure_message
["Expected #{@actual.pretty_inspect}",
"to be identical to #{@expected.pretty_inspect}"]
end
def negative_failure_message
["Expected #{@actual.pretty_inspect}",
"not to be identical to #{@expected.pretty_inspect}"]
end
end
class Object
def equal(expected)
EqualMatcher.new(expected)
end
end
|