From cf9a52a7b6a4cb28709f116b306e06395b40b752 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 7 Feb 2010 23:06:15 +0100 Subject: removes Module#as_load_path, which is no longer used --- activesupport/test/dependencies_test.rb | 5 ----- 1 file changed, 5 deletions(-) (limited to 'activesupport/test/dependencies_test.rb') diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 0fcf1eaf00..f782313411 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -1,7 +1,6 @@ require 'abstract_unit' require 'pp' require 'active_support/dependencies' -require 'active_support/core_ext/module/loading' require 'active_support/core_ext/kernel/reporting' module ModuleWithMissing @@ -130,10 +129,6 @@ class DependenciesTest < Test::Unit::TestCase end end - def test_as_load_path - assert_equal '', DependenciesTest.as_load_path - end - def test_module_loading with_autoloading_fixtures do assert_kind_of Module, A -- cgit v1.2.3 From 77f630d3171d8c0d6b89321276bfed2adf46f4c4 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Wed, 10 Feb 2010 15:06:42 -0800 Subject: Since require_dependency cannot be cleared, remove the dependencies --- activesupport/test/dependencies_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/test/dependencies_test.rb') diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index f782313411..849f68c145 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -42,12 +42,17 @@ class DependenciesTest < Test::Unit::TestCase require_dependency 'dependencies/service_one' require_dependency 'dependencies/service_two' assert_equal 2, ActiveSupport::Dependencies.loaded.size + ensure + Object.send(:remove_const, :ServiceOne) if Object.const_defined?(:ServiceOne) + Object.send(:remove_const, :ServiceTwo) if Object.const_defined?(:ServiceTwo) end def test_tracking_identical_loaded_files require_dependency 'dependencies/service_one' require_dependency 'dependencies/service_one' assert_equal 1, ActiveSupport::Dependencies.loaded.size + ensure + Object.send(:remove_const, :ServiceOne) if Object.const_defined?(:ServiceOne) end def test_missing_dependency_raises_missing_source_file -- cgit v1.2.3 From 4da45060a2e839fec4a7e9238cbc9d8de62b1b69 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sun, 14 Feb 2010 10:47:50 -0800 Subject: Simplify dependencies.rb some. Remove alias of Kernel::Foo to Object::Foo as it was not used and breaks Ruby semantics. --- activesupport/test/dependencies_test.rb | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'activesupport/test/dependencies_test.rb') 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' -- cgit v1.2.3