diff options
author | José Valim <jose.valim@gmail.com> | 2010-07-17 09:54:34 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-17 09:55:11 +0200 |
commit | c6e20586372743ce200449bf0ac21aed04c6b81e (patch) | |
tree | 8615ad840ac5f02a9e4be4b82df074934d28342a /railties/test | |
parent | 38f1ea8fe267947f4baf832d3b15ee5b83f18f71 (diff) | |
download | rails-c6e20586372743ce200449bf0ac21aed04c6b81e.tar.gz rails-c6e20586372743ce200449bf0ac21aed04c6b81e.tar.bz2 rails-c6e20586372743ce200449bf0ac21aed04c6b81e.zip |
Add skip_eager_load!, skip_autoload! and friends to path objects.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/paths_test.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/railties/test/paths_test.rb b/railties/test/paths_test.rb index 008247cb1a..80fae8c543 100644 --- a/railties/test/paths_test.rb +++ b/railties/test/paths_test.rb @@ -118,13 +118,23 @@ class PathsTest < ActiveSupport::TestCase assert_raise(RuntimeError) { @root << "/biz" } end - test "it is possible to add a path that should be loaded only once" do + test "it is possible to add a path that should be autoloaded only once" do @root.app = "/app" @root.app.autoload_once! assert @root.app.autoload_once? assert @root.autoload_once.include?(@root.app.paths.first) end + test "it is possible to remove a path that should be autoloaded only once" do + @root.app = "/app" + @root.app.autoload_once! + assert @root.app.autoload_once? + + @root.app.skip_autoload_once! + assert !@root.app.autoload_once? + assert !@root.autoload_once.include?(@root.app.paths.first) + end + test "it is possible to add a path without assignment and specify it should be loaded only once" do @root.app "/app", :autoload_once => true assert @root.app.autoload_once? @@ -152,13 +162,23 @@ class PathsTest < ActiveSupport::TestCase assert_equal 2, @root.autoload_once.size end - test "it is possible to mark a path as eager" do + test "it is possible to mark a path as eager loaded" do @root.app = "/app" @root.app.eager_load! assert @root.app.eager_load? assert @root.eager_load.include?(@root.app.paths.first) end + test "it is possible to skip a path from eager loading" do + @root.app = "/app" + @root.app.eager_load! + assert @root.app.eager_load? + + @root.app.skip_eager_load! + assert !@root.app.eager_load? + assert !@root.eager_load.include?(@root.app.paths.first) + end + test "it is possible to add a path without assignment and mark it as eager" do @root.app "/app", :eager_load => true assert @root.app.eager_load? |