diff options
author | Yehuda Katz <yehudakatz@YK.local> | 2010-02-14 10:47:50 -0800 |
---|---|---|
committer | Yehuda Katz <yehudakatz@YK.local> | 2010-02-14 10:48:06 -0800 |
commit | 4da45060a2e839fec4a7e9238cbc9d8de62b1b69 (patch) | |
tree | 1a71707b86c6548ecff07eebf0ec858ae4cdc9f5 /activesupport/test | |
parent | d68f8ba5c303556ecb8625dd146184d68b704e83 (diff) | |
download | rails-4da45060a2e839fec4a7e9238cbc9d8de62b1b69.tar.gz rails-4da45060a2e839fec4a7e9238cbc9d8de62b1b69.tar.bz2 rails-4da45060a2e839fec4a7e9238cbc9d8de62b1b69.zip |
Simplify dependencies.rb some. Remove alias of Kernel::Foo to Object::Foo as it was not used and breaks Ruby semantics.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/dependencies_test.rb | 17 |
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' |