Skip to content

Commit 95118ba

Browse files
authored
Coerce test (#1233)
1 parent c25db90 commit 95118ba

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/cases/coerced_tests.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,6 +2484,25 @@ def test_sqlcommenter_format_value_string_coercible_coerced
24842484
end
24852485
end
24862486

2487+
# SQL requires double single-quotes.
2488+
coerce_tests! :test_sqlcommenter_format_allows_string_keys
2489+
def test_sqlcommenter_format_allows_string_keys_coerced
2490+
ActiveRecord::QueryLogs.update_formatter(:sqlcommenter)
2491+
2492+
ActiveRecord::QueryLogs.tags = [
2493+
:application,
2494+
{
2495+
"string" => "value",
2496+
tracestate: "congo=t61rcWkgMzE,rojo=00f067aa0ba902b7",
2497+
custom_proc: -> { "Joe's Shack" }
2498+
},
2499+
]
2500+
2501+
assert_sql(%r{custom_proc=''Joe%27s%20Shack'',string=''value'',tracestate=''congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7''\*/}) do
2502+
Dashboard.first
2503+
end
2504+
end
2505+
24872506
# Invalid character encoding causes `ActiveRecord::StatementInvalid` error similar to Postgres.
24882507
coerce_tests! :test_invalid_encoding_query
24892508
def test_invalid_encoding_query_coerced

0 commit comments

Comments
 (0)