diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index f5c9abf1cc8cf7e0b4260ab08b36159d71151e3d..35c2b1b86ec45839a1f143664c642a574bfa739d 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -163,7 +163,7 @@ def requires_matching_verb? end def verb - %r[^#{verbs.join('|')}$] + verbs.join('|') end private diff --git a/actionpack/lib/action_dispatch/routing/inspector.rb b/actionpack/lib/action_dispatch/routing/inspector.rb index 48c10a7d4c2ead4d55bfdb344fd218ff5d6d14a6..f3a5268d2e3480ccf2574668ee3134177ef1ba49 100644 --- a/actionpack/lib/action_dispatch/routing/inspector.rb +++ b/actionpack/lib/action_dispatch/routing/inspector.rb @@ -16,10 +16,6 @@ def rack_app app.app end - def verb - super.source.gsub(/[$^]/, '') - end - def path super.spec.to_s end diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index f35ffd8845d40be441b78447595d0f376b41226a..e783df855e61e621705087c76737044a4ed5f340 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -82,7 +82,7 @@ def test_random_keys end assert_equal({:omg=>:awesome, :controller=>"posts", :action=>"index"}, fakeset.defaults.first) - assert_equal(/^GET$/, fakeset.routes.first.verb) + assert_equal("GET", fakeset.routes.first.verb) end def test_mapping_requirements @@ -99,7 +99,7 @@ def test_via_scope mapper.scope(via: :put) do mapper.match '/', :to => 'posts#index', :as => :main end - assert_equal(/^PUT$/, fakeset.routes.first.verb) + assert_equal("PUT", fakeset.routes.first.verb) end def test_map_slash diff --git a/actionpack/test/dispatch/routing/inspector_test.rb b/actionpack/test/dispatch/routing/inspector_test.rb index 24bd4b04ec1fdd18e5b631dcd4d431fea862a05c..a17d07c40b05bc4328782e3a13a331b947cd050e 100644 --- a/actionpack/test/dispatch/routing/inspector_test.rb +++ b/actionpack/test/dispatch/routing/inspector_test.rb @@ -77,6 +77,17 @@ def test_cart_inspect ], output end + def test_articles_inspect_with_multiple_verbs + output = draw do + match 'articles/:id', to: 'articles#update', via: [:put, :patch] + end + + assert_equal [ + "Prefix Verb URI Pattern Controller#Action", + " PUT|PATCH /articles/:id(.:format) articles#update" + ], output + end + def test_inspect_shows_custom_assets output = draw do get '/custom/assets', :to => 'custom_assets#show'