From c37e8d365b9470a593668476fc9be0af6da2e812 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 25 Jan 2005 17:55:55 +0000 Subject: Added methods for removing subclasses -- couldnt make it work with the regular nested-module approach (ObjectSpace was being difficult), so this is a straight inclusion git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@506 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../test/core_ext/object_and_class_ext_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 activesupport/test/core_ext/object_and_class_ext_test.rb (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb new file mode 100644 index 0000000000..5a0ae58837 --- /dev/null +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -0,0 +1,21 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../lib/core_ext/object_and_class' + +class A; end +class B < A; end +class C < B; end +class D < A; end + +class ClassExtTest < Test::Unit::TestCase + def test_methods + assert defined?(B) + assert defined?(C) + assert defined?(D) + + A.remove_subclasses + + assert !defined?(B) + assert !defined?(C) + assert !defined?(D) + end +end -- cgit v1.2.3