aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/paths_test.rb
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-26 17:32:05 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-26 17:32:05 -0700
commit188a892c5a097ee6d62249d048a6be7d2dfe9649 (patch)
tree6ef8769019e1f294156dd58551ec6656a37d4385 /railties/test/paths_test.rb
parent4153c6b720563e1c43bb96e95f0ff5fbd59d6be7 (diff)
downloadrails-188a892c5a097ee6d62249d048a6be7d2dfe9649.tar.gz
rails-188a892c5a097ee6d62249d048a6be7d2dfe9649.tar.bz2
rails-188a892c5a097ee6d62249d048a6be7d2dfe9649.zip
Starting to replace scattered path configuration settings with the path object
Diffstat (limited to 'railties/test/paths_test.rb')
-rw-r--r--railties/test/paths_test.rb21
1 files changed, 17 insertions, 4 deletions
diff --git a/railties/test/paths_test.rb b/railties/test/paths_test.rb
index e7df58579f..a1ed43ad6d 100644
--- a/railties/test/paths_test.rb
+++ b/railties/test/paths_test.rb
@@ -69,28 +69,28 @@ class PathsTest < ActiveSupport::TestCase
@root.app = "/app"
@root.app.load_once!
assert @root.app.load_once?
- assert @root.load_once.include?(@root.app)
+ assert @root.load_once.include?(@root.app.paths.first)
end
test "making a path load_once more than once only includes it once in @root.load_once" do
@root.app = "/app"
@root.app.load_once!
@root.app.load_once!
- assert_equal 1, @root.load_once.select {|p| p == @root.app }.size
+ assert_equal 1, @root.load_once.select {|p| p == @root.app.paths.first }.size
end
test "it is possible to mark a path as eager" do
@root.app = "/app"
@root.app.eager_load!
assert @root.app.eager_load?
- assert @root.eager_load.include?(@root.app)
+ assert @root.eager_load.include?(@root.app.paths.first)
end
test "making a path eager more than once only includes it once in @root.eager_paths" do
@root.app = "/app"
@root.app.eager_load!
@root.app.eager_load!
- assert_equal 1, @root.eager_load.select {|p| p == @root.app }.size
+ assert_equal 1, @root.eager_load.select {|p| p == @root.app.paths.first }.size
end
test "a path should have a glob that defaults to **/*.rb" do
@@ -103,4 +103,17 @@ class PathsTest < ActiveSupport::TestCase
@root.app.glob = "*.rb"
assert_equal "*.rb", @root.app.glob
end
+
+ test "a path can be added to the load path" do
+ @root.app = "app"
+ @root.app.load_path!
+ @root.app.models = "app/models"
+ assert_equal ["/foo/bar/app"], @root.load_paths
+ end
+
+ test "adding a path to the eager paths also adds it to the load path" do
+ @root.app = "app"
+ @root.app.eager_load!
+ assert_equal ["/foo/bar/app"], @root.load_paths
+ end
end \ No newline at end of file