From ea6b54e3c493bcde75ab7b8bcd84ca779a3b405a Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Wed, 11 Jun 2008 02:06:22 +0000 Subject: [PATCH] ActionItem392: fix route to profile with dot --- config/routes.rb | 2 +- test/integration/routing_test.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index c9932b2..f0d62c6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,7 +39,7 @@ ActionController::Routing::Routes.draw do |map| # public profile information - map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/ + map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/, :profile => /[a-z][a-z0-9._-]*/ ###################################################### ## Controllers that are profile-specific (for profile admins ) diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 19e0091..cd2b0dc 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -93,6 +93,19 @@ class RoutingTest < ActionController::IntegrationTest assert_routing('/profile/ze', :controller => 'profile', :profile => 'ze', :action => 'index') assert_routing('/profile/ze/friends', :controller => 'profile', :profile => 'ze', :action => 'friends') end + + def test_profile_with_dot_routing + assert_routing('/profile/ze.withdot', :controller => 'profile', :action => 'index', :profile => 'ze.withdot') + end + + def test_profile_with_dash_routing + assert_routing('/profile/ze-withdash', :controller => 'profile', :action => 'index', :profile => 'ze-withdash') + end + + def test_profile_with_underscore_routing + assert_routing('/profile/ze_with_underscore', :controller => 'profile', :action => 'index', :profile => 'ze_with_underscore') + end + def test_profile_route_for_tags_with_dot assert_routing('/profile/ze/tag/tag.withdot', :controller => 'profile', :profile => 'ze', :action => 'tag', :id => 'tag.withdot') -- libgit2 0.21.2