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:
parent
1b26c66ce4
commit
d39c3b179c
1 changed files with 17 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue