db-query-matchers icon indicating copy to clipboard operation
db-query-matchers copied to clipboard

With `ActiveRecord::QueryLogs.prepend_comment ` set to `true`, manipulative query checks fail

Open gagan93jtg opened this issue 1 year ago • 0 comments

If you set the above flag to true, ActiveRecord prepends the comment (query source) to the query. This causes our regex to fail because it expects the query to start with INSERT/UPDATE/DELETE. A possible fix would be to either ignore the comment or validate presence of these after the comment. The specific matcher that is failing is:

expect { some_code }.to make_database_queries(manipulative: true)

Would love to hear your thoughts on this.

gagan93jtg avatar Oct 10 '24 06:10 gagan93jtg