Permalink
Browse files

Merge [5814] from trunk.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5815 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent ba29222 commit a4e70d3e91afd0e20576e6b24632cea0cf9c0f5f @jeremy jeremy committed Dec 31, 2006
Showing with 8 additions and 2 deletions.
  1. +2 −1 activesupport/lib/active_support/dependencies.rb
  2. +6 −1 activesupport/test/dependencies_test.rb
@@ -278,7 +278,8 @@ def remove_unloadable_constants!
# Determine if the given constant has been automatically loaded.
def autoloaded?(desc)
- return false if desc.is_a?(Module) && desc.name.empty? # Empty name => anonymous module.
+ # No name => anonymous module.
+ return false if desc.is_a?(Module) && desc.name.blank?
name = to_constant_name desc
return false unless qualified_const_defined? name
return autoloaded_constants.include?(name)
@@ -305,7 +305,12 @@ def test_autoloaded?
assert Dependencies.autoloaded?("::ModuleFolder")
assert Dependencies.autoloaded?(:ModuleFolder)
- assert ! Dependencies.autoloaded?(Module.new)
+ # Anonymous modules aren't autoloaded.
+ assert !Dependencies.autoloaded?(Module.new)
+
+ nil_name = Module.new
+ def nil_name.name() nil end
+ assert !Dependencies.autoloaded?(nil_name)
Object.send :remove_const, :ModuleFolder
end

0 comments on commit a4e70d3

Please sign in to comment.