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.rb17
1 files changed, 6 insertions, 11 deletions
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 849f68c145..6ff6dfb607 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -291,7 +291,7 @@ class DependenciesTest < Test::Unit::TestCase
assert ActiveSupport::Dependencies.qualified_const_defined?("::Test::Unit::TestCase")
end
- def test_qualified_const_defined_should_not_call_method_missing
+ def test_qualified_const_defined_should_not_call_const_missing
ModuleWithMissing.missing_count = 0
assert ! ActiveSupport::Dependencies.qualified_const_defined?("ModuleWithMissing::A")
assert_equal 0, ModuleWithMissing.missing_count
@@ -299,6 +299,10 @@ class DependenciesTest < Test::Unit::TestCase
assert_equal 0, ModuleWithMissing.missing_count
end
+ def test_qualified_const_defined_explodes_with_invalid_const_name
+ assert_raises(NameError) { ActiveSupport::Dependencies.qualified_const_defined?("invalid") }
+ end
+
def test_autoloaded?
with_autoloading_fixtures do
assert ! ActiveSupport::Dependencies.autoloaded?("ModuleFolder")
@@ -333,7 +337,6 @@ class DependenciesTest < Test::Unit::TestCase
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for(:Object, :A)
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for("Object", :A)
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for("::Object", :A)
- assert_equal "A", ActiveSupport::Dependencies.qualified_name_for("::Kernel", :A)
assert_equal "ActiveSupport::Dependencies::A", ActiveSupport::Dependencies.qualified_name_for(:'ActiveSupport::Dependencies', :A)
assert_equal "ActiveSupport::Dependencies::A", ActiveSupport::Dependencies.qualified_name_for(ActiveSupport::Dependencies, :A)
@@ -460,14 +463,6 @@ class DependenciesTest < Test::Unit::TestCase
end
end
- def test_const_missing_on_kernel_should_fallback_to_object
- with_autoloading_fixtures do
- kls = Kernel::E
- assert_equal "E", kls.name
- assert_equal kls.object_id, Kernel::E.object_id
- end
- end
-
def test_preexisting_constants_are_not_marked_as_autoloaded
with_autoloading_fixtures do
require_dependency 'e'
@@ -711,7 +706,7 @@ class DependenciesTest < Test::Unit::TestCase
def test_autoload_doesnt_shadow_name_error
with_autoloading_fixtures do
Object.send(:remove_const, :RaisesNameError) if defined?(::RaisesNameError)
- 2.times do
+ 2.times do |i|
begin
::RaisesNameError::FooBarBaz.object_id
flunk 'should have raised NameError when autoloaded file referenced FooBarBaz'