Permalink
Browse files

Test added, we shouldn't log sql calls when logger is not on debug? mode

  • Loading branch information...
1 parent 1b26c66 commit d39c3b179c2c0d31099033b3de4a866e19ce144b @spastorino spastorino committed with tenderlove Jul 19, 2010
Showing with 17 additions and 0 deletions.
  1. +17 −0 activerecord/test/cases/log_subscriber_test.rb
@@ -41,4 +41,21 @@ def test_cached_queries
assert_match(/CACHE/, @logger.logged(:debug).last)
assert_match(/SELECT .*?FROM .?developers.?/i, @logger.logged(:debug).last)
end
+
+ def test_basic_query_doesnt_log_when_level_is_not_debug
+ @logger.debugging = false
+ Developer.all
+ wait
+ assert_equal 0, @logger.logged(:debug).size
+ end
+
+ def test_cached_queries_doesnt_log_when_level_is_not_debug
+ @logger.debugging = false
+ ActiveRecord::Base.cache do
+ Developer.all
+ Developer.all
+ end
+ wait
+ assert_equal 0, @logger.logged(:debug).size
+ end
end

0 comments on commit d39c3b1

Please sign in to comment.