From ccdff23664f7d2dc0b7c01bdcb79ad3a736428f1 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Sun, 15 Mar 2009 21:32:43 +0100 Subject: [PATCH] Make sure Metal use ActionController class name conventions --- railties/lib/rails/rack/metal.rb | 2 +- .../metal/pluralmetal/app/metal/legacy_routes.rb | 5 +++++ railties/test/metal_test.rb | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletions(-) create mode 100644 railties/test/fixtures/metal/pluralmetal/app/metal/legacy_routes.rb diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb index 78b8a01..adc43da 100644 --- a/railties/lib/rails/rack/metal.rb +++ b/railties/lib/rails/rack/metal.rb @@ -18,7 +18,7 @@ module Rails metal_glob.each do |glob| Dir[glob].sort.map do |file| file = file.match(matcher)[1] - all_metals[file.classify] = file + all_metals[file.camelize] = file end end diff --git a/railties/test/fixtures/metal/pluralmetal/app/metal/legacy_routes.rb b/railties/test/fixtures/metal/pluralmetal/app/metal/legacy_routes.rb new file mode 100644 index 0000000..6f9e382 --- /dev/null +++ b/railties/test/fixtures/metal/pluralmetal/app/metal/legacy_routes.rb @@ -0,0 +1,5 @@ +class LegacyRoutes < Rails::Rack::Metal + def self.call(env) + [301, { "Location" => "http://example.com"}, nil] + end +end diff --git a/railties/test/metal_test.rb b/railties/test/metal_test.rb index 143efdd..d3d2311 100644 --- a/railties/test/metal_test.rb +++ b/railties/test/metal_test.rb @@ -8,6 +8,12 @@ class MetalTest < Test::Unit::TestCase end end + def test_metals_should_respect_class_name_conventions + use_appdir("pluralmetal") do + assert_equal(["LegacyRoutes"], found_metals_as_string_array) + end + end + def test_metals_should_return_alphabetical_list_of_found_metal_apps use_appdir("multiplemetals") do assert_equal(["MetalA", "MetalB"], found_metals_as_string_array) -- 1.5.4.5