Skip to content

Commit

Permalink
Escape regexs
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan committed Sep 20, 2023
1 parent bbc2708 commit a860e86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/cases/coerced_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit a860e86

Please sign in to comment.