Skip to content

Commit

Permalink
Escape table name so that it can be used in regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan committed Oct 4, 2018
1 parent 54652d8 commit 50684d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/test/cases/relation_test.rb
Expand Up @@ -232,7 +232,7 @@ def test_relation_merging_with_merged_symbol_joins_is_aliased
assert_equal 3, nb_inner_join, "Wrong amount of INNER JOIN in query"

# using `\W` as the column separator
assert queries.any? { |sql| %r[INNER\s+JOIN\s+#{Author.quoted_table_name}\s+\Wauthors_categorizations\W]i.match?(sql) }, "Should be aliasing the child INNER JOINs in query"
assert queries.any? { |sql| %r[INNER\s+JOIN\s+#{Regexp.escape(Author.quoted_table_name)}\s+\Wauthors_categorizations\W]i.match?(sql) }, "Should be aliasing the child INNER JOINs in query"
end

def test_relation_with_merged_joins_aliased_works
Expand Down

0 comments on commit 50684d1

Please sign in to comment.