fix failure if behavior is not define and try use the default

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Cyril Mougel 2010-07-01 11:59:10 +02:00 committed by José Valim
parent e596a8e14c
commit 9024545a6b
2 changed files with 8 additions and 1 deletions

View File

@ -8,7 +8,7 @@ module ActiveSupport
attr_accessor :debug
def behavior
@behavior ||= DEFAULT_BEHAVIORS[:stderr]
@behavior ||= [DEFAULT_BEHAVIORS[:stderr]]
end
def behavior=(behavior)

View File

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