aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/deprecation_test.rb
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-12-07 16:03:18 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-12-07 18:16:30 +0900
commit59ff1ba30d9f4d34b4d478104cc3f453e553c67a (patch)
tree99eb98aed89e1be8309c68d3979993bf5f76291d /activesupport/test/deprecation_test.rb
parentf173ec77fc35ce57e94398310308e868689366bb (diff)
downloadrails-59ff1ba30d9f4d34b4d478104cc3f453e553c67a.tar.gz
rails-59ff1ba30d9f4d34b4d478104cc3f453e553c67a.tar.bz2
rails-59ff1ba30d9f4d34b4d478104cc3f453e553c67a.zip
Make `deprecate` work for non-exists methods
Before #33325, `deprecate` works for non-exist methods. This is necessary, for example, if want to deprecate dynamically defined methods like attributes methods. Fixes #34646
Diffstat (limited to 'activesupport/test/deprecation_test.rb')
-rw-r--r--activesupport/test/deprecation_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb
index 105153584d..95e7174391 100644
--- a/activesupport/test/deprecation_test.rb
+++ b/activesupport/test/deprecation_test.rb
@@ -31,6 +31,9 @@ class Deprecatee
def f=(v); end
deprecate :f=
+ deprecate :g
+ def g ;end
+
module B
C = 1
end
@@ -425,6 +428,10 @@ class DeprecationTest < ActiveSupport::TestCase
end
end
+ def test_deprecate_work_before_define_method
+ assert_deprecated { @dtc.g }
+ end
+
private
def deprecator_with_messages
klass = Class.new(ActiveSupport::Deprecation)