Commit ea6b54e3c493bcde75ab7b8bcd84ca779a3b405a
1 parent
8c753993
Exists in
master
and in
28 other branches
ActionItem392: fix route to profile with dot
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1989 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
14 additions
and
1 deletions
Show diff stats
config/routes.rb
@@ -39,7 +39,7 @@ ActionController::Routing::Routes.draw do |map| | @@ -39,7 +39,7 @@ ActionController::Routing::Routes.draw do |map| | ||
39 | 39 | ||
40 | 40 | ||
41 | # public profile information | 41 | # public profile information |
42 | - map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/ | 42 | + map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/, :profile => /[a-z][a-z0-9._-]*/ |
43 | 43 | ||
44 | ###################################################### | 44 | ###################################################### |
45 | ## Controllers that are profile-specific (for profile admins ) | 45 | ## Controllers that are profile-specific (for profile admins ) |
test/integration/routing_test.rb
@@ -93,6 +93,19 @@ class RoutingTest < ActionController::IntegrationTest | @@ -93,6 +93,19 @@ class RoutingTest < ActionController::IntegrationTest | ||
93 | assert_routing('/profile/ze', :controller => 'profile', :profile => 'ze', :action => 'index') | 93 | assert_routing('/profile/ze', :controller => 'profile', :profile => 'ze', :action => 'index') |
94 | assert_routing('/profile/ze/friends', :controller => 'profile', :profile => 'ze', :action => 'friends') | 94 | assert_routing('/profile/ze/friends', :controller => 'profile', :profile => 'ze', :action => 'friends') |
95 | end | 95 | end |
96 | + | ||
97 | + def test_profile_with_dot_routing | ||
98 | + assert_routing('/profile/ze.withdot', :controller => 'profile', :action => 'index', :profile => 'ze.withdot') | ||
99 | + end | ||
100 | + | ||
101 | + def test_profile_with_dash_routing | ||
102 | + assert_routing('/profile/ze-withdash', :controller => 'profile', :action => 'index', :profile => 'ze-withdash') | ||
103 | + end | ||
104 | + | ||
105 | + def test_profile_with_underscore_routing | ||
106 | + assert_routing('/profile/ze_with_underscore', :controller => 'profile', :action => 'index', :profile => 'ze_with_underscore') | ||
107 | + end | ||
108 | + | ||
96 | 109 | ||
97 | def test_profile_route_for_tags_with_dot | 110 | def test_profile_route_for_tags_with_dot |
98 | assert_routing('/profile/ze/tag/tag.withdot', :controller => 'profile', :profile => 'ze', :action => 'tag', :id => 'tag.withdot') | 111 | assert_routing('/profile/ze/tag/tag.withdot', :controller => 'profile', :profile => 'ze', :action => 'tag', :id => 'tag.withdot') |