refactor assert_sql query to reuse capture_sql

set assert_sql to reuse the capture_sql method from above
instead of repeating the code

in response to comments on issue #14546
This commit is contained in:
eileencodes 2014-03-31 22:53:45 -04:00
parent e9f53f7a7a
commit 49e17431ca
1 changed files with 1 additions and 3 deletions

View File

@ -26,9 +26,7 @@ module ActiveRecord
end
def assert_sql(*patterns_to_match)
SQLCounter.clear_log
yield
SQLCounter.log_all
capture_sql { yield }
ensure
failed_patterns = []
patterns_to_match.each do |pattern|