diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-16 09:18:17 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-16 09:18:17 +0000 |
commit | 80f1597942dbfdc24d532d9ebd555969deea12fe (patch) | |
tree | 94cc323a37122822fc743ab6014e7eac82efdc44 /activesupport/test | |
parent | bc7f2315ba89199bb24866ddb76ead4bbe6b71c9 (diff) | |
download | rails-80f1597942dbfdc24d532d9ebd555969deea12fe.tar.gz rails-80f1597942dbfdc24d532d9ebd555969deea12fe.tar.bz2 rails-80f1597942dbfdc24d532d9ebd555969deea12fe.zip |
Dependencies can autoload directories of nested classes.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4769 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
6 files changed, 44 insertions, 4 deletions
diff --git a/activesupport/test/autoloading_fixtures/class_folder.rb b/activesupport/test/autoloading_fixtures/class_folder.rb new file mode 100644 index 0000000000..42933acf28 --- /dev/null +++ b/activesupport/test/autoloading_fixtures/class_folder.rb @@ -0,0 +1,2 @@ +class ClassFolder +end diff --git a/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb b/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb new file mode 100644 index 0000000000..8235e90724 --- /dev/null +++ b/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb @@ -0,0 +1,2 @@ +class ClassFolder::InlineClass +end diff --git a/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb b/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb new file mode 100644 index 0000000000..08bed842cf --- /dev/null +++ b/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb @@ -0,0 +1,4 @@ +class ClassFolder + class NestedClass + end +end diff --git a/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb b/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb new file mode 100644 index 0000000000..ca83437046 --- /dev/null +++ b/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb @@ -0,0 +1,2 @@ +class ModuleFolder::InlineClass +end diff --git a/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb b/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb index 39ee0e50d5..fc4076bd0a 100644 --- a/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb +++ b/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb @@ -1,2 +1,4 @@ -class ModuleFolder::NestedClass -end
\ No newline at end of file +module ModuleFolder + class NestedClass + end +end diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index fe823a9e52..92f3e63e1a 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -125,20 +125,48 @@ class DependenciesTest < Test::Unit::TestCase end end - def test_directories_should_manifest_as_modules + def test_directories_manifest_as_modules_unless_const_defined with_loading 'autoloading_fixtures' do assert_kind_of Module, ModuleFolder Object.send :remove_const, :ModuleFolder end end - def test_nested_class_access + def test_module_with_nested_class with_loading 'autoloading_fixtures' do assert_kind_of Class, ModuleFolder::NestedClass Object.send :remove_const, :ModuleFolder end end + def test_module_with_nested_inline_class + with_loading 'autoloading_fixtures' do + assert_kind_of Class, ModuleFolder::InlineClass + Object.send :remove_const, :ModuleFolder + end + end + + def test_directories_may_manifest_as_nested_classes + with_loading 'autoloading_fixtures' do + assert_kind_of Class, ClassFolder + Object.send :remove_const, :ClassFolder + end + end + + def test_class_with_nested_class + with_loading 'autoloading_fixtures' do + assert_kind_of Class, ClassFolder::NestedClass + Object.send :remove_const, :ClassFolder + end + end + + def test_class_with_nested_inline_class + with_loading 'autoloading_fixtures' do + assert_kind_of Class, ClassFolder::InlineClass + Object.send :remove_const, :ClassFolder + end + end + def test_nested_class_can_access_sibling with_loading 'autoloading_fixtures' do sibling = ModuleFolder::NestedClass.class_eval "NestedSibling" |