Skip to content

Commit

Permalink
Checkin failing test case related to load once paths
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
seckar committed Dec 24, 2006
1 parent c172154 commit 1e170da
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
class CrossSiteDependency
end
3 changes: 3 additions & 0 deletions activesupport/test/dependencies/cross_site_depender.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
class CrossSiteDepender
CrossSiteDependency
end
28 changes: 28 additions & 0 deletions activesupport/test/dependencies_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -702,4 +702,32 @@ def test_remove_constant_handles_double_colon_at_start
assert ! defined?(DeleteMe) assert ! defined?(DeleteMe)
end 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 end

0 comments on commit 1e170da

Please sign in to comment.