diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-12 11:29:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-12 11:29:28 -0700 |
commit | 50ad7f6561aaff4f0acc00ad0c3ff8cf1217a0cc (patch) | |
tree | 3a9059386047d5b931217235a4043895a844eb18 | |
parent | 07b0b5b33067d51cab2dbfcfa0d7ae5bd787bd53 (diff) | |
download | rails-50ad7f6561aaff4f0acc00ad0c3ff8cf1217a0cc.tar.gz rails-50ad7f6561aaff4f0acc00ad0c3ff8cf1217a0cc.tar.bz2 rails-50ad7f6561aaff4f0acc00ad0c3ff8cf1217a0cc.zip |
testing quoting a string for an int column
-rw-r--r-- | activerecord/test/cases/quoting_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb index 8412a2b417..83b5a95995 100644 --- a/activerecord/test/cases/quoting_test.rb +++ b/activerecord/test/cases/quoting_test.rb @@ -3,6 +3,9 @@ require "cases/helper" module ActiveRecord module ConnectionAdapters class QuotingTest < ActiveRecord::TestCase + class FakeColumn < Struct.new(:type) + end + def setup @quoter = Class.new { include Quoting }.new end @@ -156,6 +159,15 @@ module ActiveRecord assert_equal "'lo\\\\l'", @quoter.quote(crazy, nil) assert_equal "'lo\\\\l'", @quoter.quote(crazy, Object.new) end + + def test_quote_string_no_column + assert_equal "'lo\\\\l'", @quoter.quote('lo\l', nil) + end + + def test_quote_string_int_column + assert_equal "1", @quoter.quote('1', FakeColumn.new(:integer)) + assert_equal "1", @quoter.quote('1.2', FakeColumn.new(:integer)) + end end end end |