From 46bf67664b96f6f092f15f5157517e01d59acb55 Mon Sep 17 00:00:00 2001 From: Aidan Haran Date: Wed, 20 Sep 2023 15:44:53 +0100 Subject: [PATCH] Escape regexs (#1093) --- test/cases/coerced_tests.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cases/coerced_tests.rb b/test/cases/coerced_tests.rb index 9a739193a..f1b6fe1b4 100644 --- a/test/cases/coerced_tests.rb +++ b/test/cases/coerced_tests.rb @@ -1252,7 +1252,7 @@ def test_reorder_with_take_coerced sql_log = capture_sql do assert Post.order(:title).reorder(nil).take end - assert sql_log.none? { |sql| /order by [posts].[title]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}" + assert sql_log.none? { |sql| /order by \[posts\]\.\[title\]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}" assert sql_log.all? { |sql| /order by \[posts\]\.\[id\]/i.match?(sql) }, "default ORDER BY ID was not used in the query: #{sql_log}" end @@ -1264,7 +1264,7 @@ def test_reorder_with_first_coerced post = Post.order(:title).reorder(nil).first end assert_equal posts(:welcome), post - assert sql_log.none? { |sql| /order by [posts].[title]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}" + assert sql_log.none? { |sql| /order by \[posts\]\.\[title\]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}" assert sql_log.all? { |sql| /order by \[posts\]\.\[id\]/i.match?(sql) }, "default ORDER BY ID was not used in the query: #{sql_log}" end