Commit c230d6712c3c7b80d23ee801c3a362c88e85bec7

Authored by AntonioTerceiro
1 parent 7dbb308e

ActionItem70: creating a route for category browsing



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@531 3f533792-8f58-4932-b0fe-aaf55b0a4547
config/routes.rb
... ... @@ -53,7 +53,9 @@ ActionController::Routing::Routes.draw do |map|
53 53 ######################################################
54 54 ## Public controllers
55 55 ######################################################
56   -
  56 +
  57 + map.connect 'cat/:action/*path', :controller => 'category', :action => 'index'
  58 +
57 59 # *content viewing*
58 60 # XXX this route must come last so other routes have priority over it.
59 61 map.homepage ':profile/*page', :controller => 'content_viewer', :action => 'view_page'
... ...
test/integration/routing_test.rb
... ... @@ -50,6 +50,12 @@ class RoutingTest < ActionController::IntegrationTest
50 50 assert_routing('/admin/manage_tags', :controller => 'manage_tags', :action => 'index')
51 51 end
52 52  
  53 + def test_categories_management
  54 + assert_routing('/admin/categories', :controller => 'categories', :action => 'index')
  55 + assert_routing('/admin/categories/new', :controller => 'categories', :action => 'new')
  56 + assert_routing('/admin/categories/edit/2', :controller => 'categories', :action => 'edit', :id => '2')
  57 + end
  58 +
53 59 # platform administrative controllers (system/*)
54 60 ################################################################
55 61  
... ... @@ -64,4 +70,9 @@ class RoutingTest < ActionController::IntegrationTest
64 70 assert_routing('/ze/work/2007', :controller => 'content_viewer', :action => 'view_page', :profile => 'ze', :page => ['work', "2007"])
65 71 end
66 72  
  73 + def test_category_browser
  74 + assert_routing('/cat/some_action/products/eletronics', :controller => 'category', :action => 'some_action', :path => [ 'products', 'eletronics'])
  75 + assert_routing('/cat', :controller => 'category', :action => 'index', :path => [ ])
  76 + end
  77 +
67 78 end
... ...