From 34599c4f57121bf693886b39f9a9724d41998514 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 28 Apr 2012 18:22:11 -0300 Subject: Add test for default silence and stderr deprecation behaviors --- activesupport/test/deprecation_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'activesupport/test/deprecation_test.rb') diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index e821a285d7..e21f3efe36 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -93,6 +93,26 @@ class DeprecationTest < ActiveSupport::TestCase assert_match(/foo=nil/, @b) end + def test_default_stderr_behavior + ActiveSupport::Deprecation.behavior = :stderr + behavior = ActiveSupport::Deprecation.behavior.first + + content = capture(:stderr) { + assert_nil behavior.call('Some error!', ['call stack!']) + } + assert_match(/Some error!/, content) + assert_match(/call stack!/, content) + end + + def test_default_silence_behavior + ActiveSupport::Deprecation.behavior = :silence + behavior = ActiveSupport::Deprecation.behavior.first + + assert_blank capture(:stderr) { + assert_nil behavior.call('Some error!', ['call stack!']) + } + end + def test_deprecated_instance_variable_proxy assert_not_deprecated { @dtc.request.size } -- cgit v1.2.3