diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/unsafe_raw_sql_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/unsafe_raw_sql_test.rb b/activerecord/test/cases/unsafe_raw_sql_test.rb index 861df8f1da..5809d05327 100644 --- a/activerecord/test/cases/unsafe_raw_sql_test.rb +++ b/activerecord/test/cases/unsafe_raw_sql_test.rb @@ -139,10 +139,10 @@ class UnsafeRawSqlTest < ActiveRecord::TestCase end test "order: allows Arel.sql with binds" do - ids_expected = Post.order(Arel.sql('INSTR(title, "comments"), id')).pluck(:id) + ids_expected = Post.order(Arel.sql("REPLACE(title, 'misc', 'zzzz'), id")).pluck(:id) - ids_depr = with_unsafe_raw_sql_deprecated { Post.order([Arel.sql("INSTR(title, ?), id"), "comments"]).pluck(:id) } - ids_disabled = with_unsafe_raw_sql_disabled { Post.order([Arel.sql("INSTR(title, ?), id"), "comments"]).pluck(:id) } + ids_depr = with_unsafe_raw_sql_deprecated { Post.order([Arel.sql("REPLACE(title, ?, ?), id"), "misc", "zzzz"]).pluck(:id) } + ids_disabled = with_unsafe_raw_sql_disabled { Post.order([Arel.sql("REPLACE(title, ?, ?), id"), "misc", "zzzz"]).pluck(:id) } assert_equal ids_expected, ids_depr assert_equal ids_expected, ids_disabled @@ -151,7 +151,7 @@ class UnsafeRawSqlTest < ActiveRecord::TestCase test "order: disallows invalid bind statement" do with_unsafe_raw_sql_disabled do assert_raises(ActiveRecord::UnknownAttributeReference) do - Post.order(["INSTR(title, ?), id", "comments"]).pluck(:id) + Post.order(["REPLACE(title, ?, ?), id", "misc", "zzzz"]).pluck(:id) end end end |