diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-24 11:57:22 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-24 11:57:22 +0000 |
commit | 872ddaf290c954972a52c19dec8c0d6a5f726fdd (patch) | |
tree | 776695c5857e51ac7804979580458ee8a6615744 /activerecord/test | |
parent | b29c01ea8914422c6f7e0bb5c65d3b8610dc54d1 (diff) | |
download | rails-872ddaf290c954972a52c19dec8c0d6a5f726fdd.tar.gz rails-872ddaf290c954972a52c19dec8c0d6a5f726fdd.tar.bz2 rails-872ddaf290c954972a52c19dec8c0d6a5f726fdd.zip |
Added bind-named arrays for interpolating a group of ids or strings in conditions #528 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@485 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/finder_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb index 723166c8ad..d79bc0f365 100755 --- a/activerecord/test/finder_test.rb +++ b/activerecord/test/finder_test.rb @@ -146,7 +146,15 @@ class FinderTest < Test::Unit::TestCase assert_nothing_raised { bind ':a :a', :a => 1 } # ' ruby-mode assert_raises(ActiveRecord::PreparedStatementInvalid) { bind ':a :a', :a => 1, :b => 2 } # ' ruby-mode end - + + def test_bind_array + 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)) + end + def test_string_sanitation assert_not_equal "'something ' 1=1'", ActiveRecord::Base.sanitize("something ' 1=1") assert_equal "'something; select table'", ActiveRecord::Base.sanitize("something; select table") |