mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Add #concat to Rails::Application::Path
This commit is contained in:
@@ -76,7 +76,7 @@ module Rails
|
||||
@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!
|
||||
|
||||
@@ -80,6 +80,10 @@ module Rails
|
||||
@paths.unshift path
|
||||
end
|
||||
|
||||
def concat(paths)
|
||||
@paths.concat paths
|
||||
end
|
||||
|
||||
def load_once!
|
||||
@load_once = true
|
||||
@root.load_once.push *self.paths
|
||||
|
||||
@@ -52,6 +52,12 @@ class PathsTest < ActiveSupport::TestCase
|
||||
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 @@ class PathsTest < ActiveSupport::TestCase
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user