aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-12 11:34:21 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-12 11:34:21 -0700
commit2681dd81b4c70c26bc29a56bf7c0f31bd17dbf3d (patch)
tree6484c594b689c50e421fdf49c941ec539a78075c
parent4804cb485c20aa1edc294bd0be887fe2bf2a4379 (diff)
downloadrails-2681dd81b4c70c26bc29a56bf7c0f31bd17dbf3d.tar.gz
rails-2681dd81b4c70c26bc29a56bf7c0f31bd17dbf3d.tar.bz2
rails-2681dd81b4c70c26bc29a56bf7c0f31bd17dbf3d.zip
test quoting strings with binary columns
-rw-r--r--activerecord/test/cases/quoting_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb
index da88b9e4c4..cb5191a1f1 100644
--- a/activerecord/test/cases/quoting_test.rb
+++ b/activerecord/test/cases/quoting_test.rb
@@ -173,6 +173,19 @@ module ActiveRecord
assert_equal "1.0", @quoter.quote('1', FakeColumn.new(:float))
assert_equal "1.2", @quoter.quote('1.2', FakeColumn.new(:float))
end
+
+ def test_quote_binary_without_string_to_binary
+ assert_equal "'lo\\\\l'", @quoter.quote('lo\l', FakeColumn.new(:binary))
+ end
+
+ def test_quote_binary_with_string_to_binary
+ col = Class.new(FakeColumn) {
+ def self.string_to_binary(value)
+ 'foo'
+ end
+ }.new(:binary)
+ assert_equal "'foo'", @quoter.quote('lo\l', col)
+ end
end
end
end