aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/deprecation_test.rb
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-07-08 10:09:39 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2010-07-08 10:09:39 -0400
commit4a1207d54077348b67fad95ffde5710cf0be31bd (patch)
treede721528fa81f1dfe50449c2d5c3985f513e83cd /activesupport/test/deprecation_test.rb
parentf6fa6cf6117e691899c821b8999bd7dfb3f48b38 (diff)
parentdc364fdc595405aa3d5735e60d46ad3f9544a65b (diff)
downloadrails-4a1207d54077348b67fad95ffde5710cf0be31bd.tar.gz
rails-4a1207d54077348b67fad95ffde5710cf0be31bd.tar.bz2
rails-4a1207d54077348b67fad95ffde5710cf0be31bd.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activesupport/test/deprecation_test.rb')
-rw-r--r--activesupport/test/deprecation_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb
index cf27357b32..cad0810241 100644
--- a/activesupport/test/deprecation_test.rb
+++ b/activesupport/test/deprecation_test.rb
@@ -80,6 +80,19 @@ class DeprecationTest < ActiveSupport::TestCase
assert_deprecated(/foo=nil/) { @dtc.partially }
end
+ def test_several_behaviors
+ @a, @b = nil, nil
+
+ ActiveSupport::Deprecation.behavior = [
+ Proc.new { |msg, callstack| @a = msg },
+ Proc.new { |msg, callstack| @b = msg }
+ ]
+
+ @dtc.partially
+ assert_match(/foo=nil/, @a)
+ assert_match(/foo=nil/, @b)
+ end
+
def test_deprecated_instance_variable_proxy
assert_not_deprecated { @dtc.request.size }
@@ -123,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 }