Permalink
Browse files

Add #concat to Rails::Application::Path

  • Loading branch information...
1 parent f281745 commit 132e6d00638dc6370fafa0f1377d3bca17eee2d1 Carl Lerche committed Jun 30, 2009
Showing with 12 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/configuration.rb
  2. +4 −0 railties/lib/rails/paths.rb
  3. +7 −0 railties/test/paths_test.rb
View
2 railties/lib/rails/configuration.rb
@@ -76,7 +76,7 @@ def set_root_path!
@paths.config.locales = "config/locales"
@paths.config.environments = "config/environments"
- builtin_directories.each { |dir| @paths.app.controllers << dir }
+ @paths.app.controllers.concat builtin_directories
@paths.app.load_path!
@paths.app.metals.load_path!
View
4 railties/lib/rails/paths.rb
@@ -80,6 +80,10 @@ def unshift(path)
@paths.unshift path
end
+ def concat(paths)
+ @paths.concat paths
+ end
+
def load_once!
@load_once = true
@root.load_once.push *self.paths
View
7 railties/test/paths_test.rb
@@ -52,6 +52,12 @@ def setup
assert_equal ["/app", "/app2"], @root.app.to_a
end
+ test "adding multiple physical paths using concat" do
+ @root.app = "/app"
+ @root.app.concat ["/app2", "/app3"]
+ assert_equal ["/app", "/app2", "/app3"], @root.app.to_a
+ end
+
test "adding multiple physical paths using #unshift" do
@root.app = "/app"
@root.app.unshift "/app2"
@@ -62,6 +68,7 @@ def setup
assert_raise(RuntimeError) { Rails::Application::Root.new(["/fiz", "/biz"]) }
assert_raise(NoMethodError) { @root.push "/biz" }
assert_raise(NoMethodError) { @root.unshift "/biz" }
+ assert_raise(NoMethodError) { @root.concat ["/biz"]}
assert_raise(NoMethodError) { @root << "/biz" }
end

0 comments on commit 132e6d0

Please sign in to comment.