Skip to content
This repository
Browse code

Add #concat to Rails::Application::Path

  • Loading branch information...
commit 132e6d00638dc6370fafa0f1377d3bca17eee2d1 1 parent f281745
Carl Lerche authored
2  railties/lib/rails/configuration.rb
@@ -76,7 +76,7 @@ def set_root_path!
76 76 @paths.config.locales = "config/locales"
77 77 @paths.config.environments = "config/environments"
78 78
79   - builtin_directories.each { |dir| @paths.app.controllers << dir }
  79 + @paths.app.controllers.concat builtin_directories
80 80
81 81 @paths.app.load_path!
82 82 @paths.app.metals.load_path!
4 railties/lib/rails/paths.rb
@@ -80,6 +80,10 @@ def unshift(path)
80 80 @paths.unshift path
81 81 end
82 82
  83 + def concat(paths)
  84 + @paths.concat paths
  85 + end
  86 +
83 87 def load_once!
84 88 @load_once = true
85 89 @root.load_once.push *self.paths
7 railties/test/paths_test.rb
@@ -52,6 +52,12 @@ def setup
52 52 assert_equal ["/app", "/app2"], @root.app.to_a
53 53 end
54 54
  55 + test "adding multiple physical paths using concat" do
  56 + @root.app = "/app"
  57 + @root.app.concat ["/app2", "/app3"]
  58 + assert_equal ["/app", "/app2", "/app3"], @root.app.to_a
  59 + end
  60 +
55 61 test "adding multiple physical paths using #unshift" do
56 62 @root.app = "/app"
57 63 @root.app.unshift "/app2"
@@ -62,6 +68,7 @@ def setup
62 68 assert_raise(RuntimeError) { Rails::Application::Root.new(["/fiz", "/biz"]) }
63 69 assert_raise(NoMethodError) { @root.push "/biz" }
64 70 assert_raise(NoMethodError) { @root.unshift "/biz" }
  71 + assert_raise(NoMethodError) { @root.concat ["/biz"]}
65 72 assert_raise(NoMethodError) { @root << "/biz" }
66 73 end
67 74

0 comments on commit 132e6d0

Please sign in to comment.
Something went wrong with that request. Please try again.