aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-11 17:51:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-11 17:52:10 -0700
commit8e8a5f33f4e3190738a9d7e46f9d07bcd916d9d9 (patch)
treeed187d4a6734b70e52f7b571d204c4b1db9403e2 /activerecord/test
parent2610bcbd94760bf7d601dae9477ae112a0a1147b (diff)
downloadrails-8e8a5f33f4e3190738a9d7e46f9d07bcd916d9d9.tar.gz
rails-8e8a5f33f4e3190738a9d7e46f9d07bcd916d9d9.tar.bz2
rails-8e8a5f33f4e3190738a9d7e46f9d07bcd916d9d9.zip
test quoting nils, true, false, id
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/quoting_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb
index bd4b174b12..22aab378de 100644
--- a/activerecord/test/cases/quoting_test.rb
+++ b/activerecord/test/cases/quoting_test.rb
@@ -90,6 +90,26 @@ module ActiveRecord
ensure
ActiveRecord::Base.default_timezone = before
end
+
+ def test_quote_with_quoted_id
+ assert_equal 1, @quoter.quote(Struct.new(:quoted_id).new(1), nil)
+ assert_equal 1, @quoter.quote(Struct.new(:quoted_id).new(1), 'foo')
+ end
+
+ def test_quote_nil
+ assert_equal 'NULL', @quoter.quote(nil, nil)
+ assert_equal 'NULL', @quoter.quote(nil, 'foo')
+ end
+
+ def test_quote_true
+ assert_equal @quoter.quoted_true, @quoter.quote(true, nil)
+ assert_equal '1', @quoter.quote(true, Struct.new(:type).new(:integer))
+ end
+
+ def test_quote_false
+ assert_equal @quoter.quoted_false, @quoter.quote(false, nil)
+ assert_equal '0', @quoter.quote(false, Struct.new(:type).new(:integer))
+ end
end
end
end