blob: 5ba4856d8274efbc520e1bd4fa81cf2b9ae25a97 (
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 #{MSpec.format(@actual)}",
"to be identical to #{MSpec.format(@expected)}"]
end
def negative_failure_message
["Expected #{MSpec.format(@actual)}",
"not to be identical to #{MSpec.format(@expected)}"]
end
end
module MSpecMatchers
private def equal(expected)
EqualMatcher.new(expected)
end
end
|