Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/cases/coerced_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2484,6 +2484,25 @@ def test_sqlcommenter_format_value_string_coercible_coerced
end
end

# SQL requires double single-quotes.
coerce_tests! :test_sqlcommenter_format_allows_string_keys
def test_sqlcommenter_format_allows_string_keys_coerced
ActiveRecord::QueryLogs.update_formatter(:sqlcommenter)

ActiveRecord::QueryLogs.tags = [
:application,
{
"string" => "value",
tracestate: "congo=t61rcWkgMzE,rojo=00f067aa0ba902b7",
custom_proc: -> { "Joe's Shack" }
},
]

assert_sql(%r{custom_proc=''Joe%27s%20Shack'',string=''value'',tracestate=''congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7''\*/}) do
Dashboard.first
end
end

# Invalid character encoding causes `ActiveRecord::StatementInvalid` error similar to Postgres.
coerce_tests! :test_invalid_encoding_query
def test_invalid_encoding_query_coerced
Expand Down
Loading