aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 31702cfd33..8a1bacce15 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -413,6 +413,10 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ resources :sections, :id => /.+/ do
+ get :preview, :on => :member
+ end
+
match '/:locale/*file.:format', :to => 'files#show', :file => /path\/to\/existing\/file/
end
end
@@ -1946,6 +1950,18 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_greedy_resource_id_regexp_doesnt_match_edit_and_custom_action
+ with_test_routes do
+ get '/sections/1/edit'
+ assert_equal 'sections#edit', @response.body
+ assert_equal '/sections/1/edit', edit_section_path(:id => '1')
+
+ get '/sections/1/preview'
+ assert_equal 'sections#preview', @response.body
+ assert_equal '/sections/1/preview', preview_section_path(:id => '1')
+ end
+ end
+
private
def with_test_routes
yield