diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-07-20 04:28:51 +0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-20 04:32:08 +0800 |
commit | d39c3b179c2c0d31099033b3de4a866e19ce144b (patch) | |
tree | 5d5c25bbfb8e86509963e548d77241c28d73043e /activerecord/test/cases | |
parent | 1b26c66ce470ce68674bbdce738c6f68467cff7d (diff) | |
download | rails-d39c3b179c2c0d31099033b3de4a866e19ce144b.tar.gz rails-d39c3b179c2c0d31099033b3de4a866e19ce144b.tar.bz2 rails-d39c3b179c2c0d31099033b3de4a866e19ce144b.zip |
Test added, we shouldn't log sql calls when logger is not on debug? mode
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/log_subscriber_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb index fa53fc7477..2a207bed8a 100644 --- a/activerecord/test/cases/log_subscriber_test.rb +++ b/activerecord/test/cases/log_subscriber_test.rb @@ -41,4 +41,21 @@ class LogSubscriberTest < ActiveRecord::TestCase 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 |