diff options
author | eileencodes <eileencodes@gmail.com> | 2014-03-31 19:18:04 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2014-03-31 19:28:44 -0400 |
commit | a67293638e0c9022e69b67ae89bc5bca70f70efd (patch) | |
tree | cd9002cc6c394b15329cdd3204e429eec20cf431 /activerecord/test | |
parent | 5eb13fcaac5c7328e048bf4e5d2d8418fefc5ac1 (diff) | |
download | rails-a67293638e0c9022e69b67ae89bc5bca70f70efd.tar.gz rails-a67293638e0c9022e69b67ae89bc5bca70f70efd.tar.bz2 rails-a67293638e0c9022e69b67ae89bc5bca70f70efd.zip |
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.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/test_case.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/test_case.rb b/activerecord/test/cases/test_case.rb index 4476ce3410..cbf6ea36bf 100644 --- a/activerecord/test/cases/test_case.rb +++ b/activerecord/test/cases/test_case.rb @@ -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 |