Ensure that loading metals from the main app and engines works on older Ruby versions [#2143 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
Simon Jefford 2009-03-05 18:50:52 -06:00 committed by Joshua Peek
parent 3191535ff0
commit e97180c273
2 changed files with 14 additions and 3 deletions

@ -15,9 +15,11 @@ def self.metals
metal_glob = metal_paths.map{ |base| "#{base}/**/*.rb" }
all_metals = {}
Dir[*metal_glob].sort.map do |file|
file = file.match(matcher)[1]
all_metals[file.classify] = file
metal_glob.each do |glob|
Dir[glob].sort.map do |file|
file = file.match(matcher)[1]
all_metals[file.classify] = file
end
end
load_list = requested_metals || all_metals.keys

@ -41,6 +41,15 @@ def test_metal_finding_with_requested_metals_should_work_with_subfolders
end
end
def test_metal_finding_should_work_with_multiple_metal_paths_in_185_and_below
use_appdir("singlemetal") do
engine_metal_path = "#{File.dirname(__FILE__)}/fixtures/plugins/engines/engine/app/metal"
Rails::Rack::Metal.metal_paths << engine_metal_path
$LOAD_PATH << engine_metal_path
assert_equal(["FooMetal", "EngineMetal"], found_metals_as_string_array)
end
end
private
def use_appdir(root)