Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Print the queries that were executed if assert_queries fails

  • Loading branch information...
commit 3dfecfe77347421fbb54be70a5a84eb47c30acb6 1 parent bb557b4
@tarmo tarmo authored NZKoz committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  activerecord/lib/active_record/test_case.rb
View
2  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)
Please sign in to comment.
Something went wrong with that request. Please try again.