Skip to content

Commit 46bf676

Browse files
authored
Escape regexs (#1093)
1 parent bbc2708 commit 46bf676

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/cases/coerced_tests.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ def test_reorder_with_take_coerced
12521252
sql_log = capture_sql do
12531253
assert Post.order(:title).reorder(nil).take
12541254
end
1255-
assert sql_log.none? { |sql| /order by [posts].[title]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}"
1255+
assert sql_log.none? { |sql| /order by \[posts\]\.\[title\]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}"
12561256
assert sql_log.all? { |sql| /order by \[posts\]\.\[id\]/i.match?(sql) }, "default ORDER BY ID was not used in the query: #{sql_log}"
12571257
end
12581258

@@ -1264,7 +1264,7 @@ def test_reorder_with_first_coerced
12641264
post = Post.order(:title).reorder(nil).first
12651265
end
12661266
assert_equal posts(:welcome), post
1267-
assert sql_log.none? { |sql| /order by [posts].[title]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}"
1267+
assert sql_log.none? { |sql| /order by \[posts\]\.\[title\]/i.match?(sql) }, "ORDER BY title was used in the query: #{sql_log}"
12681268
assert sql_log.all? { |sql| /order by \[posts\]\.\[id\]/i.match?(sql) }, "default ORDER BY ID was not used in the query: #{sql_log}"
12691269
end
12701270

0 commit comments

Comments
 (0)