aboutsummaryrefslogtreecommitdiffstats
path: root/spec/mspec/lib/mspec/matchers/be_nan.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/lib/mspec/matchers/be_nan.rb')
-rw-r--r--spec/mspec/lib/mspec/matchers/be_nan.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/mspec/lib/mspec/matchers/be_nan.rb b/spec/mspec/lib/mspec/matchers/be_nan.rb
new file mode 100644
index 0000000000..aa19391211
--- /dev/null
+++ b/spec/mspec/lib/mspec/matchers/be_nan.rb
@@ -0,0 +1,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
+
+class Object
+ def be_nan
+ BeNaNMatcher.new
+ end
+end