diff options
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 |