1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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 attr_accessor :debug
def behavior def behavior
@behavior ||= DEFAULT_BEHAVIORS[:stderr] @behavior ||= [DEFAULT_BEHAVIORS[:stderr]]
end end
def behavior=(behavior) def behavior=(behavior)

View file

@ -136,6 +136,13 @@ class DeprecationTest < ActiveSupport::TestCase
assert_equal 123, result assert_equal 123, result
end 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 def test_silence
ActiveSupport::Deprecation.silence do ActiveSupport::Deprecation.silence do
assert_not_deprecated { @dtc.partially } assert_not_deprecated { @dtc.partially }