diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-12-24 14:41:29 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-12-24 14:41:29 +0000 |
commit | 1e170da30db4be2ecfb83a5690b260a4ecfc19b3 (patch) | |
tree | 2ca67bf4ee0d95f0bed10280440f459d653aa3de /activesupport | |
parent | c172154054f2f1908820459bb63e8e8645136ea7 (diff) | |
download | rails-1e170da30db4be2ecfb83a5690b260a4ecfc19b3.tar.gz rails-1e170da30db4be2ecfb83a5690b260a4ecfc19b3.tar.bz2 rails-1e170da30db4be2ecfb83a5690b260a4ecfc19b3.zip |
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
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/autoloading_fixtures/cross_site_dependency.rb | 2 | ||||
-rw-r--r-- | activesupport/test/dependencies/cross_site_depender.rb | 3 | ||||
-rw-r--r-- | activesupport/test/dependencies_test.rb | 28 |
3 files changed, 33 insertions, 0 deletions
diff --git a/activesupport/test/autoloading_fixtures/cross_site_dependency.rb b/activesupport/test/autoloading_fixtures/cross_site_dependency.rb new file mode 100644 index 0000000000..21ee554e92 --- /dev/null +++ b/activesupport/test/autoloading_fixtures/cross_site_dependency.rb @@ -0,0 +1,2 @@ +class CrossSiteDependency +end
\ No newline at end of file diff --git a/activesupport/test/dependencies/cross_site_depender.rb b/activesupport/test/dependencies/cross_site_depender.rb new file mode 100644 index 0000000000..a31015fc5e --- /dev/null +++ b/activesupport/test/dependencies/cross_site_depender.rb @@ -0,0 +1,3 @@ +class CrossSiteDepender + CrossSiteDependency +end
\ No newline at end of file diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 52f83e0f9f..d5c9cb58cb 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -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 |