diff options
author | bronzdoc <lsagastume1990@gmail.com> | 2020-04-19 08:18:29 -0600 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-08 07:38:50 +0900 |
commit | 0e85a39dc70328641c3155f66568feedbe6dd15f (patch) | |
tree | ceca5a76908cfc7c25b0b10e70aa2273f5070556 /test/rubygems | |
parent | 7db538a7c92bcbcccb97d2ffcf505bee4d85e7d3 (diff) |
[rubygems/rubygems] Restore and deprecate old deprecate method
https://github.com/rubygems/rubygems/commit/024267fa60
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3087
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/test_deprecate.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/rubygems/test_deprecate.rb b/test/rubygems/test_deprecate.rb index 27f72431b0..e5e9350dc5 100644 --- a/test/rubygems/test_deprecate.rb +++ b/test/rubygems/test_deprecate.rb @@ -54,6 +54,20 @@ class TestDeprecate < Gem::TestCase end + class OtherThing + + extend Gem::Deprecate + attr_accessor :message + def foo + @message = "foo" + end + def bar + @message = "bar" + end + deprecate :foo, :bar, 2099, 3 + + end + def test_deprecated_method_calls_the_old_method capture_io do thing = Thing.new @@ -91,4 +105,16 @@ class TestDeprecate < Gem::TestCase Gem::Commands.send(:remove_const, :FooCommand) end + def test_deprecated_method_outputs_a_warning_old_way + out, err = capture_io do + thing = OtherThing.new + thing.foo + end + + assert_equal "", out + assert_match(/Gem::Deprecate#deprecate has been deprecated with no replacement and it will be removed in Rubygems 4\./, err) + assert_match(/Thing#foo is deprecated; use bar instead\./, err) + assert_match(/on or after 2099-03-01/, err) + end + end |