Checkin failing test case related to load once paths

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Nicholas Seckar 2006-12-24 14:41:29 +00:00
parent c172154054
commit 1e170da30d
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,2 @@
class CrossSiteDependency
end

View File

@ -0,0 +1,3 @@
class CrossSiteDepender
CrossSiteDependency
end

View File

@ -702,4 +702,32 @@ class DependenciesTest < Test::Unit::TestCase
assert ! defined?(DeleteMe)
end
def test_load_once_constants_should_not_be_unloaded
with_loading 'autoloading_fixtures' do
Dependencies.load_once_paths = Dependencies.load_paths
::A
assert defined?(A)
Dependencies.clear
assert defined?(A)
end
ensure
Dependencies.load_once_paths = []
Object.send :remove_const, :A rescue nil
end
def test_load_once_paths_should_behave_when_recursively_loading
with_loading 'dependencies', 'autoloading_fixtures' do
Dependencies.load_once_paths = [Dependencies.load_paths.last]
CrossSiteDepender.nil?
assert defined?(CrossSiteDependency)
assert ! Dependencies.autoloaded?(CrossSiteDependency),
"CrossSiteDependency shouldn't be marked as autoloaded!"
Dependencies.clear
assert defined?(CrossSiteDependency),
"CrossSiteDependency shouldn't have been unloaded!"
end
ensure
Dependencies.load_once_paths = []
end
end