aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2019-07-16 13:39:00 +0930
committerGitHub <noreply@github.com>2019-07-16 13:39:00 +0930
commit5a9301ce47f1117c8d457cad2b850f932bf7f518 (patch)
treeb8370f6ad3a9e0ba05087167312c1e61789100a9 /activesupport/test
parent71b0ca2aba85b8f1aee490390f46190f1656dbb2 (diff)
parent48c0abb4748c30adeecc17058f0220e87bcbe84a (diff)
downloadrails-5a9301ce47f1117c8d457cad2b850f932bf7f518.tar.gz
rails-5a9301ce47f1117c8d457cad2b850f932bf7f518.tar.bz2
rails-5a9301ce47f1117c8d457cad2b850f932bf7f518.zip
Merge pull request #36557 from sikachu/fix-source-annotation-extractor-annotation
Fix problem with accessing deprecated constant proxy's subclass
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/deprecation_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb
index f25c704586..ae2f4a6e58 100644
--- a/activesupport/test/deprecation_test.rb
+++ b/activesupport/test/deprecation_test.rb
@@ -38,6 +38,11 @@ class Deprecatee
C = 1
end
A = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("Deprecatee::A", "Deprecatee::B::C")
+
+ module New
+ class Descendant; end
+ end
+ Old = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("Deprecatee::Old", "Deprecatee::New")
end
class DeprecateeWithAccessor
@@ -210,6 +215,18 @@ class DeprecationTest < ActiveSupport::TestCase
assert_not_deprecated { assert_equal Deprecatee::B::C.class, Deprecatee::A.class }
end
+ def test_deprecated_constant_descendant
+ assert_not_deprecated { Deprecatee::New::Descendant }
+
+ assert_deprecated("Deprecatee::Old") do
+ assert_equal Deprecatee::Old::Descendant, Deprecatee::New::Descendant
+ end
+
+ assert_raises(NameError) do
+ assert_deprecated("Deprecatee::Old") { Deprecatee::Old::NON_EXISTENCE }
+ end
+ end
+
def test_deprecated_constant_accessor
assert_not_deprecated { DeprecateeWithAccessor::B::C }
assert_deprecated("DeprecateeWithAccessor::A") { assert_equal DeprecateeWithAccessor::B::C, DeprecateeWithAccessor::A }