mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Show executed queries when assert_sql assertion fails [#2573 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
parent
ab83db9d06
commit
4246a79a99
1 changed files with 1 additions and 1 deletions
|
@ -20,7 +20,7 @@ module ActiveRecord
|
||||||
patterns_to_match.each do |pattern|
|
patterns_to_match.each do |pattern|
|
||||||
failed_patterns << pattern unless $queries_executed.any?{ |sql| pattern === sql }
|
failed_patterns << pattern unless $queries_executed.any?{ |sql| pattern === sql }
|
||||||
end
|
end
|
||||||
assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map(&:inspect).join(', ')} not found."
|
assert failed_patterns.empty?, "Query pattern(s) #{failed_patterns.map(&:inspect).join(', ')} not found.#{$queries_executed.size == 0 ? '' : "\nQueries:\n#{$queries_executed.join("\n")}"}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_queries(num = 1)
|
def assert_queries(num = 1)
|
||||||
|
|
Loading…
Reference in a new issue