Skip to content
Browse files

Strip regexp anchors from rake routes output [#5934 state:resolved]

  • Loading branch information...
1 parent c7fac8c commit 4b33bd9888262d55789b5e72c67aa9ac75f3a03c @pixeltrix pixeltrix committed Nov 9, 2010
Showing with 11 additions and 1 deletion.
  1. +2 −1 actionpack/lib/action_dispatch/routing/route.rb
  2. +9 −0 railties/test/application/rake_test.rb
View
3 actionpack/lib/action_dispatch/routing/route.rb
@@ -34,7 +34,8 @@ def verb
if method = conditions[:request_method]
case method
when Regexp
- method.source.upcase
+ source = method.source.upcase
+ source =~ /\A\^[-A-Z|]+\$\Z/ ? source[1..-2] : source
else
method.to_s.upcase
end
View
9 railties/test/application/rake_test.rb
@@ -38,5 +38,14 @@ def test_code_statistics_sanity
assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0",
Dir.chdir(app_path){ `rake stats` }
end
+
+ def test_rake_routes_output_strips_anchors_from_http_verbs
+ app_file "config/routes.rb", <<-RUBY
+ AppTemplate::Application.routes.draw do
+ get '/cart', :to => 'cart#show'
+ end
+ RUBY
+ assert_match 'cart GET /cart(.:format)', Dir.chdir(app_path){ `rake routes` }
+ end
end
end

0 comments on commit 4b33bd9

Please sign in to comment.
Something went wrong with that request. Please try again.