Permalink
Browse files

Show executed queries when assert_sql assertion fails [#2573 state:re…

…solved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
miloops authored and lifo committed Apr 27, 2009
1 parent ab83db9 commit 4246a79a991af6c4c5a9473d01e805a5ac04624a
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/test_case.rb
@@ -20,7 +20,7 @@ def assert_sql(*patterns_to_match)
patterns_to_match.each do |pattern|
failed_patterns << pattern unless $queries_executed.any?{ |sql| pattern === sql }
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
def assert_queries(num = 1)

0 comments on commit 4246a79

Please sign in to comment.