Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add spec to ensure that Array#eql? checks type of argument

  • Loading branch information...
commit 9aef0fca4d67a9f18fadad881b2a5f032e63ab78 1 parent 903c837
Alex Dowad alexdowad authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 core/array/eql_spec.rb
12 core/array/eql_spec.rb
View
@@ -12,4 +12,16 @@
[1, 2, 3, 4].send(@method, [1, 2, 3, 4.0]).should be_false
end
+it "returns false if other is not an Array or subclass" do
+ class NotAnArray
+ def to_ary
+ [1,2,3]
+ end
+ def ==(other)
+ true
+ end
+ end
+
+ [1,2,3].eql?(NotAnArray.new).should be_false
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.