aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-11 17:08:40 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-11 17:52:10 -0700
commitb9d4341bd00280f2bd33a9d55a82d8a28c1efd02 (patch)
treeb20591e4d299d6d8d9c96a6ccc672a6b6bc4581b /activerecord
parentdde54f00c6c08d1704d011d8108106076e8ea033 (diff)
downloadrails-b9d4341bd00280f2bd33a9d55a82d8a28c1efd02.tar.gz
rails-b9d4341bd00280f2bd33a9d55a82d8a28c1efd02.tar.bz2
rails-b9d4341bd00280f2bd33a9d55a82d8a28c1efd02.zip
starting to get the quote module under test
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/quoting_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb
new file mode 100644
index 0000000000..bfb287749c
--- /dev/null
+++ b/activerecord/test/cases/quoting_test.rb
@@ -0,0 +1,30 @@
+require "cases/helper"
+
+module ActiveRecord
+ module ConnectionAdapters
+ class QuotingTest < ActiveRecord::TestCase
+ def setup
+ @quoter = Class.new { include Quoting }.new
+ end
+
+ def test_quoted_true
+ assert_equal "'t'", @quoter.quoted_true
+ end
+
+ def test_quoted_false
+ assert_equal "'f'", @quoter.quoted_false
+ end
+
+ def test_quote_column_name
+ assert_equal "foo", @quoter.quote_column_name('foo')
+ end
+
+ def test_quote_string
+ assert_equal "''", @quoter.quote_string("'")
+ assert_equal "\\\\", @quoter.quote_string("\\")
+ assert_equal "hi''i", @quoter.quote_string("hi'i")
+ assert_equal "hi\\\\i", @quoter.quote_string("hi\\i")
+ end
+ end
+ end
+end