diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-06-12 18:50:24 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-06-12 18:50:24 +0100 |
commit | c52520166be48299b589dbccd7d1ee22b1095ffb (patch) | |
tree | 40fe77cfafd7de58a60ca0b72b5445f3301cada2 /activerecord/lib | |
parent | 232c66a1ba3c683655856d277b7227faa37fb8c3 (diff) | |
download | rails-c52520166be48299b589dbccd7d1ee22b1095ffb.tar.gz rails-c52520166be48299b589dbccd7d1ee22b1095ffb.tar.bz2 rails-c52520166be48299b589dbccd7d1ee22b1095ffb.zip |
Make assert_no_queries literally enforce that there are no queries. As in, not a single line of SQL should be sent to the database, not even stuff that is ignored by assert_queries. The argument being that if you write assert_no_queries, you really do not want there to be any queries.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/test_case.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/test_case.rb b/activerecord/lib/active_record/test_case.rb index 23e449b67c..ffe9b08dce 100644 --- a/activerecord/lib/active_record/test_case.rb +++ b/activerecord/lib/active_record/test_case.rb @@ -50,7 +50,11 @@ module ActiveRecord end def assert_no_queries(&block) + prev_ignored_sql = ActiveRecord::SQLCounter.ignored_sql + ActiveRecord::SQLCounter.ignored_sql = [] assert_queries(0, &block) + ensure + ActiveRecord::SQLCounter.ignored_sql = prev_ignored_sql end def with_kcode(kcode) |