blob: b279d8f1cfd52e1ceddb401701a791fbce709498 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
class BeNaNMatcher
def matches?(actual)
@actual = actual
@actual.kind_of?(Float) && @actual.nan?
end
def failure_message
["Expected #{@actual}", "to be NaN"]
end
def negative_failure_message
["Expected #{@actual}", "not to be NaN"]
end
end
module MSpecMatchers
private def be_nan
BeNaNMatcher.new
end
end
|