diff options
Diffstat (limited to 'spec/mspec/lib/mspec/matchers/eql.rb')
-rw-r--r-- | spec/mspec/lib/mspec/matchers/eql.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/mspec/lib/mspec/matchers/eql.rb b/spec/mspec/lib/mspec/matchers/eql.rb new file mode 100644 index 0000000000..82117d862c --- /dev/null +++ b/spec/mspec/lib/mspec/matchers/eql.rb @@ -0,0 +1,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 |