aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/finder_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-08-16 06:26:30 +0000
committerMichael Koziarski <michael@koziarski.com>2007-08-16 06:26:30 +0000
commit29b0707f07f148d98515125dab44b73cfdc0a3d4 (patch)
tree9566ad90027d1164feb52ab57e5ec109eb1d0c02 /activerecord/test/finder_test.rb
parentf008566d656fb3b86c6421520ffcd05828a2108f (diff)
downloadrails-29b0707f07f148d98515125dab44b73cfdc0a3d4.tar.gz
rails-29b0707f07f148d98515125dab44b73cfdc0a3d4.tar.bz2
rails-29b0707f07f148d98515125dab44b73cfdc0a3d4.zip
Improve performance and functionality of the postgresql adapter. Closes #8049 [roderickvd]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7329 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/finder_test.rb')
-rw-r--r--activerecord/test/finder_test.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb
index d9809d4b7e..ef995aeb3f 100644
--- a/activerecord/test/finder_test.rb
+++ b/activerecord/test/finder_test.rb
@@ -268,18 +268,20 @@ class FinderTest < Test::Unit::TestCase
end
def test_bind_enumerable
+ quoted_abc = %(#{ActiveRecord::Base.connection.quote('a')},#{ActiveRecord::Base.connection.quote('b')},#{ActiveRecord::Base.connection.quote('c')})
+
assert_equal '1,2,3', bind('?', [1, 2, 3])
- assert_equal %('a','b','c'), bind('?', %w(a b c))
+ assert_equal quoted_abc, 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)) # '
+ 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 %('a','b','c'), bind('?', Set.new(%w(a b c)))
+ assert_equal quoted_abc, 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))) # '
+ assert_equal quoted_abc, bind(':a', :a => Set.new(%w(a b c))) # '
end
def test_bind_empty_enumerable
@@ -290,7 +292,7 @@ class FinderTest < Test::Unit::TestCase
end
def test_bind_string
- assert_equal "''", bind('?', '')
+ assert_equal ActiveRecord::Base.connection.quote(''), bind('?', '')
end
def test_bind_record
@@ -302,8 +304,8 @@ class FinderTest < Test::Unit::TestCase
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")
+ assert_not_equal "#{ActiveRecord::Base.connection.quoted_string_prefix}'something ' 1=1'", ActiveRecord::Base.sanitize("something ' 1=1")
+ assert_equal "#{ActiveRecord::Base.connection.quoted_string_prefix}'something; select table'", ActiveRecord::Base.sanitize("something; select table")
end
def test_count