Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't depend on order of elements in Set

  • Loading branch information...
commit a307fd6bd37d12d8ad6baa7e7fcfd0207e8b354a 1 parent 1e4be20
Evan Phoenix authored
Showing with 16 additions and 5 deletions.
  1. +16 −5 activerecord/test/cases/finder_test.rb
21 activerecord/test/cases/finder_test.rb
View
@@ -502,6 +502,18 @@ def test_named_bind_variables
assert_kind_of Time, Topic.find(:first, :conditions => ["id = :id", { :id => 1 }]).written_on
end
+ class SimpleEnumerable
+ include Enumerable
+
+ def initialize(ary)
+ @ary = ary
+ end
+
+ def each(&b)
+ @ary.each(&b)
+ end
+ end
+
def test_bind_enumerable
quoted_abc = %(#{ActiveRecord::Base.connection.quote('a')},#{ActiveRecord::Base.connection.quote('b')},#{ActiveRecord::Base.connection.quote('c')})
@@ -511,12 +523,11 @@ def test_bind_enumerable
assert_equal '1,2,3', bind(':a', :a => [1, 2, 3])
assert_equal quoted_abc, bind(':a', :a => %w(a b c)) # '
- require 'set'
- assert_equal '1,2,3', bind('?', Set.new([1, 2, 3]))
- assert_equal quoted_abc, bind('?', Set.new(%w(a b c)))
+ assert_equal '1,2,3', bind('?', SimpleEnumerable.new([1, 2, 3]))
+ assert_equal quoted_abc, bind('?', SimpleEnumerable.new(%w(a b c)))
- assert_equal '1,2,3', bind(':a', :a => Set.new([1, 2, 3]))
- assert_equal quoted_abc, bind(':a', :a => Set.new(%w(a b c))) # '
+ assert_equal '1,2,3', bind(':a', :a => SimpleEnumerable.new([1, 2, 3]))
+ assert_equal quoted_abc, bind(':a', :a => SimpleEnumerable.new(%w(a b c))) # '
end
def test_bind_empty_enumerable
Please sign in to comment.
Something went wrong with that request. Please try again.