Permalink
Browse files

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

  • Loading branch information...
1 parent 4e0477c commit ef46b9f21a275249d1b0cf9926ffb879b0ae2c44 @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
@@ -30,7 +30,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
@@ -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 ef46b9f

Please sign in to comment.