diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-16 06:44:48 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-16 06:44:48 +0000 |
commit | 253a2bbefb707fa5f16c61c8db978790cac777d1 (patch) | |
tree | 476f04767e3cc0b509900128c11143257793f6ea /activerecord/test | |
parent | a895be0259eb2e47fab8de3c8d30c700a304d441 (diff) | |
download | rails-253a2bbefb707fa5f16c61c8db978790cac777d1.tar.gz rails-253a2bbefb707fa5f16c61c8db978790cac777d1.tar.bz2 rails-253a2bbefb707fa5f16c61c8db978790cac777d1.zip |
Allow any Enumerable, not just Array, to work as bind variables #1344 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1442 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/finder_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index 7a2a0ab0a1..bec7a2dcc0 100644 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -156,12 +156,19 @@ class FinderTest < Test::Unit::TestCase assert_raises(ActiveRecord::PreparedStatementInvalid) { bind ':a :a', :a => 1, :b => 2 } # ' ruby-mode end - def test_bind_array + def test_bind_enumerable assert_equal '1,2,3', bind('?', [1, 2, 3]) assert_equal %('a','b','c'), bind('?', %w(a b c)) assert_equal '1,2,3', bind(':a', :a => [1, 2, 3]) assert_equal %('a','b','c'), bind(':a', :a => %w(a b c)) # ' + + require 'set' + assert_equal '1,2,3', bind('?', Set.new([1, 2, 3])) + assert_equal %('a','b','c'), bind('?', Set.new(%w(a b c))) + + assert_equal '1,2,3', bind(':a', :a => Set.new([1, 2, 3])) + assert_equal %('a','b','c'), bind(':a', :a => Set.new(%w(a b c))) # ' end def test_string_sanitation |