Skip to content

Commit

Permalink
perform_database_query_matcher should be truthy as long as one query …
Browse files Browse the repository at this point in the history
…matches (activeadmin#8471)

* perform_database_query_matcher should be truthy as long as one query
matches

Before this commit the order or SQL queries matter:

- match, not match

results in a false matching when it should be true

* Update spec/support/matchers/perform_database_query_matcher.rb

Co-authored-by: Javier Julio <[email protected]>

---------

Co-authored-by: Javier Julio <[email protected]>
  • Loading branch information
mgrunberg and javierjulio authored Sep 4, 2024
1 parent 7117d59 commit 1477e90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion spec/support/matchers/perform_database_query_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
@match = nil

callback = lambda do |_name, _started, _finished, _unique_id, payload|
@match = query_regexp.match?(payload[:sql])
if query_regexp.match?(payload[:sql])
@match = true
end
end

ActiveSupport::Notifications.subscribed(callback, "sql.active_record", &block)
Expand Down

0 comments on commit 1477e90

Please sign in to comment.