Commit f00650b1dbc86f861e44efacd15060bcbc15897d
1 parent
99105ec2
Exists in
master
and in
29 other branches
ActionItem403: fixing error on tags with dot
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1912 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
11 additions
and
2 deletions
Show diff stats
config/routes.rb
| @@ -28,7 +28,8 @@ ActionController::Routing::Routes.draw do |map| | @@ -28,7 +28,8 @@ ActionController::Routing::Routes.draw do |map| | ||
| 28 | 28 | ||
| 29 | # tags | 29 | # tags |
| 30 | map.tag 'tag', :controller => 'search', :action => 'tags' | 30 | map.tag 'tag', :controller => 'search', :action => 'tags' |
| 31 | - map.tag 'tag/:tag', :controller => 'search', :action => 'tag' | 31 | + map.tag 'tag/:tag', :controller => 'search', :action => 'tag', :tag => /.*/ |
| 32 | + | ||
| 32 | # categories index | 33 | # categories index |
| 33 | map.category 'cat/*category_path', :controller => 'search', :action => 'category_index' | 34 | map.category 'cat/*category_path', :controller => 'search', :action => 'category_index' |
| 34 | map.assets 'assets/:asset/*category_path', :controller => 'search', :action => 'assets' | 35 | map.assets 'assets/:asset/*category_path', :controller => 'search', :action => 'assets' |
| @@ -38,7 +39,7 @@ ActionController::Routing::Routes.draw do |map| | @@ -38,7 +39,7 @@ ActionController::Routing::Routes.draw do |map| | ||
| 38 | 39 | ||
| 39 | 40 | ||
| 40 | # public profile information | 41 | # public profile information |
| 41 | - map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index' | 42 | + map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/ |
| 42 | 43 | ||
| 43 | ###################################################### | 44 | ###################################################### |
| 44 | ## Controllers that are profile-specific (for profile admins ) | 45 | ## Controllers that are profile-specific (for profile admins ) |
test/integration/routing_test.rb
| @@ -85,10 +85,18 @@ class RoutingTest < ActionController::IntegrationTest | @@ -85,10 +85,18 @@ class RoutingTest < ActionController::IntegrationTest | ||
| 85 | assert_routing('/tag/umboraminhaporra', :controller => 'search', :action => 'tag', :tag => 'umboraminhaporra') | 85 | assert_routing('/tag/umboraminhaporra', :controller => 'search', :action => 'tag', :tag => 'umboraminhaporra') |
| 86 | end | 86 | end |
| 87 | 87 | ||
| 88 | + def test_view_tag_with_dot | ||
| 89 | + assert_routing('/tag/tag.withdot', :controller => 'search', :action => 'tag', :tag => 'tag.withdot') | ||
| 90 | + end | ||
| 91 | + | ||
| 88 | def test_profile_routing | 92 | def test_profile_routing |
| 89 | assert_routing('/profile/ze', :controller => 'profile', :profile => 'ze', :action => 'index') | 93 | assert_routing('/profile/ze', :controller => 'profile', :profile => 'ze', :action => 'index') |
| 90 | assert_routing('/profile/ze/friends', :controller => 'profile', :profile => 'ze', :action => 'friends') | 94 | assert_routing('/profile/ze/friends', :controller => 'profile', :profile => 'ze', :action => 'friends') |
| 91 | end | 95 | end |
| 96 | + | ||
| 97 | + 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') | ||
| 99 | + end | ||
| 92 | 100 | ||
| 93 | def test_search_routing | 101 | def test_search_routing |
| 94 | assert_routing('/search', :controller => 'search', :action => 'index', :category_path => []) | 102 | assert_routing('/search', :controller => 'search', :action => 'index', :category_path => []) |