From 9024545a6b019e3a2596a4194e84e77963e31b05 Mon Sep 17 00:00:00 2001 From: Cyril Mougel Date: Thu, 1 Jul 2010 11:59:10 +0200 Subject: fix failure if behavior is not define and try use the default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activesupport/lib/active_support/deprecation/behaviors.rb | 2 +- activesupport/test/deprecation_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/deprecation/behaviors.rb b/activesupport/lib/active_support/deprecation/behaviors.rb index f0842f201d..f54f65dcf0 100644 --- a/activesupport/lib/active_support/deprecation/behaviors.rb +++ b/activesupport/lib/active_support/deprecation/behaviors.rb @@ -8,7 +8,7 @@ module ActiveSupport attr_accessor :debug def behavior - @behavior ||= DEFAULT_BEHAVIORS[:stderr] + @behavior ||= [DEFAULT_BEHAVIORS[:stderr]] end def behavior=(behavior) diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index 44f1aebb37..cad0810241 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -136,6 +136,13 @@ class DeprecationTest < ActiveSupport::TestCase assert_equal 123, result end + def test_assert_deprecated_warn_work_with_default_behavior + ActiveSupport::Deprecation.instance_variable_set('@behavior' , nil) + assert_deprecated('abc') do + ActiveSupport::Deprecation.warn 'abc' + end + end + def test_silence ActiveSupport::Deprecation.silence do assert_not_deprecated { @dtc.partially } -- cgit v1.2.3