diff options
Diffstat (limited to 'activerecord/test')
-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 |