aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/quoting_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-14 13:55:29 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-14 13:58:09 -0700
commitaa31d21f5f4fc4d679e74a60f9df9706da7de373 (patch)
tree05581a0beef46e3620cc39cbb2fccf6c6b752d81 /activerecord/test/cases/quoting_test.rb
parent855cca0662f6a82b1eb450135f9c679e75723311 (diff)
downloadrails-aa31d21f5f4fc4d679e74a60f9df9706da7de373.tar.gz
rails-aa31d21f5f4fc4d679e74a60f9df9706da7de373.tar.bz2
rails-aa31d21f5f4fc4d679e74a60f9df9706da7de373.zip
Don't default to YAML dumping when quoting values
This behavior exists only to support fixtures, so we should handle it there. Leaving it in `#quote` can cause very subtle bugs to slip through, by things appearing to work when they should be blowing up loudly, such as #18385.
Diffstat (limited to 'activerecord/test/cases/quoting_test.rb')
-rw-r--r--activerecord/test/cases/quoting_test.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb
index 1d6ae2f67f..ad09340518 100644
--- a/activerecord/test/cases/quoting_test.rb
+++ b/activerecord/test/cases/quoting_test.rb
@@ -125,14 +125,11 @@ module ActiveRecord
end
def test_crazy_object
- crazy = Class.new.new
- expected = "'#{YAML.dump(crazy)}'"
- assert_equal expected, @quoter.quote(crazy, nil)
- end
-
- def test_crazy_object_calls_quote_string
- crazy = Class.new { def initialize; @lol = 'lo\l' end }.new
- assert_match "lo\\\\l", @quoter.quote(crazy, nil)
+ crazy = Object.new
+ e = assert_raises(TypeError) do
+ @quoter.quote(crazy, nil)
+ end
+ assert_equal "can't quote Object", e.message
end
def test_quote_string_no_column