aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/dependencies_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/dependencies_test.rb')
-rw-r--r--activesupport/test/dependencies_test.rb45
1 files changed, 37 insertions, 8 deletions
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