1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

This commit is contained in:
Santiago Pastorino 2010-07-20 04:28:51 +08:00 committed by Aaron Patterson
parent 1b26c66ce4
commit d39c3b179c

View file

@ -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