Skip to content

Commit

Permalink
Make sure Metal use ActionController class name conventions [#2242 st…
Browse files Browse the repository at this point in the history
…ate:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information
Luca Guidi authored and josh committed Mar 15, 2009
1 parent 7706b57 commit 5f10533
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion railties/lib/rails/rack/metal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.metals
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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class LegacyRoutes < Rails::Rack::Metal
def self.call(env)
[301, { "Location" => "http://example.com"}, nil]
end
end
6 changes: 6 additions & 0 deletions railties/test/metal_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ def test_metals_should_return_list_of_found_metal_apps
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)
Expand Down

0 comments on commit 5f10533

Please sign in to comment.