diff options
Diffstat (limited to 'activesupport/test/testing/deprecation_test.rb')
-rw-r--r-- | activesupport/test/testing/deprecation_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/activesupport/test/testing/deprecation_test.rb b/activesupport/test/testing/deprecation_test.rb new file mode 100644 index 0000000000..e3c07aab8a --- /dev/null +++ b/activesupport/test/testing/deprecation_test.rb @@ -0,0 +1,21 @@ +require 'abstract_unit' +require 'active_support/deprecation' + +class DeprecationTestingTest < ActiveSupport::TestCase + def setup + @klass = Class.new do + def new_method; "abc" end + alias_method :old_method, :new_method + end + end + + def test_assert_deprecated_raises_when_method_not_deprecated + assert_raises(Minitest::Assertion) { assert_deprecated { @klass.new.old_method } } + end + + def test_assert_not_deprecated + ActiveSupport::Deprecation.deprecate_methods(@klass, :old_method => :new_method) + + assert_raises(Minitest::Assertion) { assert_not_deprecated { @klass.new.old_method } } + end +end |