aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorCyril Mougel <cyril.mougel@gmail.com>2010-07-01 11:59:10 +0200
committerJosé Valim <jose.valim@gmail.com>2010-07-01 12:17:21 +0200
commit9024545a6b019e3a2596a4194e84e77963e31b05 (patch)
tree86311a9bcc75b2c2a87a2bcac487bc89942487e3 /activesupport
parente596a8e14cfb1f2ca19cd20ae7e40047d4819b3e (diff)
downloadrails-9024545a6b019e3a2596a4194e84e77963e31b05.tar.gz
rails-9024545a6b019e3a2596a4194e84e77963e31b05.tar.bz2
rails-9024545a6b019e3a2596a4194e84e77963e31b05.zip
fix failure if behavior is not define and try use the default
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/deprecation/behaviors.rb2
-rw-r--r--activesupport/test/deprecation_test.rb7
2 files changed, 8 insertions, 1 deletions
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 }