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:
parent
e596a8e14c
commit
9024545a6b
2 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
Loading…
Reference in a new issue