From 8e8a5f33f4e3190738a9d7e46f9d07bcd916d9d9 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 11 Oct 2010 17:51:48 -0700 Subject: test quoting nils, true, false, id --- activerecord/test/cases/quoting_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'activerecord/test') 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 -- cgit v1.2.3