diff options
author | Eileen M. Uchitelle <eileencodes@gmail.com> | 2015-09-25 08:40:03 -0400 |
---|---|---|
committer | Eileen M. Uchitelle <eileencodes@gmail.com> | 2015-09-25 08:40:03 -0400 |
commit | 73eec7ac4008c178b6cacf71a20457fcfbe7c515 (patch) | |
tree | 0a89571f0e844cae6d4ffab69c6374c384ad8b13 /activerecord/test/cases | |
parent | 2b419594586e0db4dd6a5525efd5340b8e7bb0ef (diff) | |
parent | 14d265217a40a98f430961fd5e32713176ceccf9 (diff) | |
download | rails-73eec7ac4008c178b6cacf71a20457fcfbe7c515.tar.gz rails-73eec7ac4008c178b6cacf71a20457fcfbe7c515.tar.bz2 rails-73eec7ac4008c178b6cacf71a20457fcfbe7c515.zip |
Merge pull request #21758 from yui-knk/fix_sanitize_test_example
Quote prepared statements of `sanitize_sql_array`
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/sanitize_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/sanitize_test.rb b/activerecord/test/cases/sanitize_test.rb index 262e0abc22..14e392ac30 100644 --- a/activerecord/test/cases/sanitize_test.rb +++ b/activerecord/test/cases/sanitize_test.rb @@ -9,11 +9,11 @@ class SanitizeTest < ActiveRecord::TestCase def test_sanitize_sql_array_handles_string_interpolation quoted_bambi = ActiveRecord::Base.connection.quote_string("Bambi") - assert_equal "name=#{quoted_bambi}", Binary.send(:sanitize_sql_array, ["name=%s", "Bambi"]) - assert_equal "name=#{quoted_bambi}", Binary.send(:sanitize_sql_array, ["name=%s", "Bambi".mb_chars]) + assert_equal "name='#{quoted_bambi}'", Binary.send(:sanitize_sql_array, ["name='%s'", "Bambi"]) + assert_equal "name='#{quoted_bambi}'", Binary.send(:sanitize_sql_array, ["name='%s'", "Bambi".mb_chars]) quoted_bambi_and_thumper = ActiveRecord::Base.connection.quote_string("Bambi\nand\nThumper") - assert_equal "name=#{quoted_bambi_and_thumper}",Binary.send(:sanitize_sql_array, ["name=%s", "Bambi\nand\nThumper"]) - assert_equal "name=#{quoted_bambi_and_thumper}",Binary.send(:sanitize_sql_array, ["name=%s", "Bambi\nand\nThumper".mb_chars]) + assert_equal "name='#{quoted_bambi_and_thumper}'",Binary.send(:sanitize_sql_array, ["name='%s'", "Bambi\nand\nThumper"]) + assert_equal "name='#{quoted_bambi_and_thumper}'",Binary.send(:sanitize_sql_array, ["name='%s'", "Bambi\nand\nThumper".mb_chars]) end def test_sanitize_sql_array_handles_bind_variables |