mirror of
https://github.com/github/rails.git
synced 2026-01-30 00:38:00 -05:00
Checkin forgotten add. Update const_missing handler to avoid double loading files.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4729 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -155,7 +155,7 @@ module Dependencies #:nodoc:
|
||||
name_error = NameError.new("uninitialized constant #{qualified_name}")
|
||||
|
||||
file_path = search_for_autoload_file(path_suffix)
|
||||
if file_path # We found a matching file to load
|
||||
if file_path #&& ! loaded.include?(file_path) # We found a matching file to load
|
||||
require_or_load file_path, qualified_name
|
||||
raise LoadError, "Expected #{file_path} to define #{qualified_name}" unless from_mod.const_defined?(const_name)
|
||||
return from_mod.const_get(const_name)
|
||||
|
||||
@@ -300,4 +300,13 @@ class DependenciesTest < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_const_missing_should_not_double_load
|
||||
with_loading 'autoloading_fixtures' do
|
||||
require_dependency 'counting_loader'
|
||||
assert_equal 1, $counting_loaded_times
|
||||
ModuleFolder
|
||||
assert_equal 1, $counting_loaded_times
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user