From f7a0a394f48a0f21e686f891546d17ce33c7840e Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 7 Feb 2009 14:44:50 +0000 Subject: Remove hardcoded number_of_capturesin ControllerSegment to allow regexp requirements with capturing parentheses Signed-off-by: Michael Koziarski [#1887 state:committed] --- actionpack/test/controller/routing_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 1caed33c59..d3fe62e28e 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -852,6 +852,15 @@ class LegacyRouteSetTests < Test::Unit::TestCase assert_equal '/content/foo', rs.generate(:controller => "content", :action => "foo") end + def test_route_with_regexp_and_captures_for_controller + rs.draw do |map| + map.connect ':controller/:action/:id', :controller => /admin\/(accounts|users)/ + end + assert_equal({:controller => "admin/accounts", :action => "index"}, rs.recognize_path("/admin/accounts")) + assert_equal({:controller => "admin/users", :action => "index"}, rs.recognize_path("/admin/users")) + assert_raises(ActionController::RoutingError) { rs.recognize_path("/admin/products") } + end + def test_route_with_regexp_and_dot rs.draw do |map| map.connect ':controller/:action/:file', -- cgit v1.2.3