diff options
-rw-r--r-- | railties/lib/rails/paths.rb | 3 | ||||
-rw-r--r-- | railties/test/paths_test.rb | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 9b4a69f19f..3c2210aaf9 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -51,7 +51,8 @@ module Rails end def []=(path, value) - add(path, :with => value) + glob = self[path] ? self[path].glob : nil + add(path, :with => value, :glob => glob) end def add(path, options={}) diff --git a/railties/test/paths_test.rb b/railties/test/paths_test.rb index d334034e7d..491c45da70 100644 --- a/railties/test/paths_test.rb +++ b/railties/test/paths_test.rb @@ -198,6 +198,13 @@ class PathsTest < ActiveSupport::TestCase assert_equal "*.rb", @root["app"].glob end + test "it should be possible to replace a path and persist the original paths glob" do + @root.add "app", :glob => "*.rb" + @root["app"] = "app2" + assert_equal ["/foo/bar/app2"], @root["app"].paths + 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! |