mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
add capture_sql method to compare sql statements and compare
Other methods compare specific patterns, this method outputs the actual sql query that is generated.
This commit is contained in:
parent
5eb13fcaac
commit
a67293638e
1 changed files with 6 additions and 0 deletions
|
@ -19,6 +19,12 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
|
||||
def capture_sql
|
||||
SQLCounter.clear_log
|
||||
yield
|
||||
SQLCounter.log_all.dup
|
||||
end
|
||||
|
||||
def assert_sql(*patterns_to_match)
|
||||
SQLCounter.clear_log
|
||||
yield
|
||||
|
|
Loading…
Reference in a new issue