aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/object_and_class_ext_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/object_and_class_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/object_and_class_ext_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb
index a0a6243480..cf75159575 100644
--- a/activesupport/test/core_ext/object_and_class_ext_test.rb
+++ b/activesupport/test/core_ext/object_and_class_ext_test.rb
@@ -5,6 +5,13 @@ class ClassA; end
class ClassB < ClassA; end
class ClassC < ClassB; end
class ClassD < ClassA; end
+class RemoveSubsTestClass; end
+class RemoveSubsBaseClass
+ def self.add_ivar
+ @ivar = RemoveSubsTestClass.new
+ end
+end
+class RemoveSubsSubClass < RemoveSubsBaseClass; end
class ClassExtTest < Test::Unit::TestCase
def test_methods
@@ -30,4 +37,15 @@ class ObjectTests < Test::Unit::TestCase
suppress(LoadError, ArgumentError) { raise LoadError }
suppress(LoadError, ArgumentError) { raise ArgumentError }
end
+
+ def test_remove_subclasses_of_unsets_ivars
+ r = RemoveSubsSubClass.new
+ RemoveSubsSubClass.add_ivar
+ RemoveSubsBaseClass.remove_subclasses
+
+ GC.start
+ ObjectSpace.each_object do |o|
+ flunk("ObjectSpace still contains RemoveSubsTestClass") if o.class == RemoveSubsTestClass
+ end
+ end
end \ No newline at end of file