aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2012-12-21 19:15:36 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2012-12-21 19:15:36 +0100
commitf914454f3af46a011d2ea627925cadea73f62e92 (patch)
treed30a605ded5ac89a5c95e9e382eaa1cabf52507e /activesupport/test
parente0176bf7327c088ddc995d7306e72820a2713698 (diff)
downloadrails-f914454f3af46a011d2ea627925cadea73f62e92.tar.gz
rails-f914454f3af46a011d2ea627925cadea73f62e92.tar.bz2
rails-f914454f3af46a011d2ea627925cadea73f62e92.zip
Add ActiveSupport::Logger#silence that works the same as the old Logger#silence extension
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/logger_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/logger_test.rb b/activesupport/test/logger_test.rb
index eedeca30a8..d2801849ca 100644
--- a/activesupport/test/logger_test.rb
+++ b/activesupport/test/logger_test.rb
@@ -120,4 +120,14 @@ class LoggerTest < ActiveSupport::TestCase
byte_string.force_encoding("ASCII-8BIT")
assert byte_string.include?(BYTE_STRING)
end
+
+ def test_silencing_everything_but_errors
+ @logger.silence do
+ @logger.debug "NOT THERE"
+ @logger.error "THIS IS HERE"
+ end
+
+ assert !@output.string.include?("NOT THERE")
+ assert @output.string.include?("THIS IS HERE")
+ end
end