Permalink
Browse files

Print the queries that were executed if assert_queries fails

  • Loading branch information...
1 parent bb557b4 commit 3dfecfe77347421fbb54be70a5a84eb47c30acb6 @tarmo tarmo committed with NZKoz Aug 26, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/test_case.rb
@@ -37,7 +37,7 @@ def assert_queries(num = 1)
$queries_executed = []
yield
ensure
- assert_equal num, $queries_executed.size, "#{$queries_executed.size} instead of #{num} queries were executed."
+ assert_equal num, $queries_executed.size, "#{$queries_executed.size} instead of #{num} queries were executed.#{$queries_executed.size == 0 ? '' : "\nQueries:\n#{$queries_executed.join("\n")}"}"
end
def assert_no_queries(&block)

0 comments on commit 3dfecfe

Please sign in to comment.