diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2006-02-04 21:24:40 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2006-02-04 21:24:40 +0000 |
commit | 6fa5b7b304ae9d4a56232e436feec8cc691ad92a (patch) | |
tree | ea8ce3dddd8c4308c6241b2dab3a706694c5393c /activesupport/test | |
parent | 9474fe72dd388559aa013717e9e91b5a87aa872c (diff) | |
download | rails-6fa5b7b304ae9d4a56232e436feec8cc691ad92a.tar.gz rails-6fa5b7b304ae9d4a56232e436feec8cc691ad92a.tar.bz2 rails-6fa5b7b304ae9d4a56232e436feec8cc691ad92a.zip |
added some (pointless) test cases to dependency loading, the more the merrier
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3537 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/autoloading_fixtures/a/c/e/f.rb | 2 | ||||
-rw-r--r-- | activesupport/test/dependencies_test.rb | 45 |
2 files changed, 39 insertions, 8 deletions
diff --git a/activesupport/test/autoloading_fixtures/a/c/e/f.rb b/activesupport/test/autoloading_fixtures/a/c/e/f.rb new file mode 100644 index 0000000000..57dba5a307 --- /dev/null +++ b/activesupport/test/autoloading_fixtures/a/c/e/f.rb @@ -0,0 +1,2 @@ +class A::C::E::F +end
\ No newline at end of file diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 953a64a0ef..af7c09068c 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -106,14 +106,43 @@ class DependenciesTest < Test::Unit::TestCase end def test_module_loading - $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/autoloading_fixtures" - old_mechanism, Dependencies.mechanism = Dependencies.mechanism, :load + begin + $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/autoloading_fixtures" + old_mechanism, Dependencies.mechanism = Dependencies.mechanism, :load + + assert_kind_of Module, A + assert_kind_of Class, A::B + assert_kind_of Class, A::C::D + assert_kind_of Class, A::C::E::F + ensure + $LOAD_PATH.shift + Dependencies.mechanism = old_mechanism + end + end + + def test_non_existing_cost_raises_nameerrror + begin + $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/autoloading_fixtures" + old_mechanism, Dependencies.mechanism = Dependencies.mechanism, :load + assert_raises(NameError) do + DoesNotExist + end + + assert_raises(NameError) do + NoModule::DoesNotExist + end + + assert_raises(NameError) do + A::DoesNotExist + end + + assert_raises(NameError) do + A::B::DoesNotExist + end + ensure + $LOAD_PATH.shift + Dependencies.mechanism = old_mechanism + end - assert_kind_of Module, A - assert_kind_of Class, A::B - assert_kind_of Class, A::C::D - ensure - $LOAD_PATH.shift - Dependencies.mechanism = old_mechanism end end |