aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/deprecation_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-10-24 16:56:59 +0000
committerJamis Buck <jamis@37signals.com>2006-10-24 16:56:59 +0000
commit3a318970b19129c2ba57ebf576015dfa653613e8 (patch)
treea9676d0d1db7ed9fc823d52af4573317805e3525 /activesupport/test/deprecation_test.rb
parent53a97e9d610c03024b21d5d87681d98b5ed115bf (diff)
downloadrails-3a318970b19129c2ba57ebf576015dfa653613e8.tar.gz
rails-3a318970b19129c2ba57ebf576015dfa653613e8.tar.bz2
rails-3a318970b19129c2ba57ebf576015dfa653613e8.zip
Extend deprecate so that alternatives can be specified via the deprecation
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5356 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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 bbcee24f5c..21baa11a80 100644
--- a/activesupport/test/deprecation_test.rb
+++ b/activesupport/test/deprecation_test.rb
@@ -17,6 +17,13 @@ class Deprecatee
def one(a) a end
def multi(a,b,c) [a,b,c] end
deprecate :none, :one, :multi
+
+ def a; end
+ def b; end
+ def c; end
+ def d; end
+ def e; end
+ deprecate :a, :b, :c => :e, :d => "you now need to do something extra for this one"
end
@@ -108,4 +115,17 @@ class DeprecationTest < Test::Unit::TestCase
assert_not_deprecated { @dtc.partially }
ActiveSupport::Deprecation.silenced = false
end
+
+ def test_deprecation_without_explanation
+ assert_deprecated { @dtc.a }
+ assert_deprecated { @dtc.b }
+ end
+
+ def test_deprecation_with_alternate_method
+ assert_deprecated(/use e instead/) { @dtc.c }
+ end
+
+ def test_deprecation_with_explicit_message
+ assert_deprecated(/you now need to do something extra for this one/) { @dtc.d }
+ end
end