aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/class_test.rb
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-03-11 22:07:48 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-03-11 22:07:48 +1100
commit965fe59bff249ad91131a444e1fbd63dc4411db3 (patch)
treeec2d54d5eaad9e32bce1758e6a67c364279bbd39 /activesupport/test/core_ext/class_test.rb
parent79f02a473cb6aef00003745f23802314c8c89e7d (diff)
parent4adcbb6b2d6cef49ac28df4254ac74e09f14dcf7 (diff)
downloadrails-965fe59bff249ad91131a444e1fbd63dc4411db3.tar.gz
rails-965fe59bff249ad91131a444e1fbd63dc4411db3.tar.bz2
rails-965fe59bff249ad91131a444e1fbd63dc4411db3.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activesupport/test/core_ext/class_test.rb')
-rw-r--r--activesupport/test/core_ext/class_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/class_test.rb b/activesupport/test/core_ext/class_test.rb
new file mode 100644
index 0000000000..b7f3dd9930
--- /dev/null
+++ b/activesupport/test/core_ext/class_test.rb
@@ -0,0 +1,29 @@
+require 'abstract_unit'
+require 'active_support/core_ext/class'
+
+class A
+end
+
+module X
+ class B
+ end
+end
+
+module Y
+ module Z
+ class C
+ end
+ end
+end
+
+class ClassTest < Test::Unit::TestCase
+ def test_retrieving_subclasses
+ @parent = eval("class D; end; D")
+ @sub = eval("class E < D; end; E")
+ @subofsub = eval("class F < E; end; F")
+ assert_equal 2, @parent.subclasses.size
+ assert_equal [@subofsub.to_s], @sub.subclasses
+ assert_equal [], @subofsub.subclasses
+ assert_equal [@sub.to_s, @subofsub.to_s].sort, @parent.subclasses.sort
+ end
+end