Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 1e170da30db4be2ecfb83a5690b260a4ecfc19b3 1 parent c172154
@seckar seckar authored
View
2  activesupport/test/autoloading_fixtures/cross_site_dependency.rb
@@ -0,0 +1,2 @@
+class CrossSiteDependency
+end
View
3  activesupport/test/dependencies/cross_site_depender.rb
@@ -0,0 +1,3 @@
+class CrossSiteDepender
+ CrossSiteDependency
+end
View
28 activesupport/test/dependencies_test.rb
@@ -702,4 +702,32 @@ def test_remove_constant_handles_double_colon_at_start
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
Please sign in to comment.
Something went wrong with that request. Please try again.