Commit c95d491c9545c64163088259fd6310fc9b5204d1

Authored by AntonioTerceiro
1 parent 8383b80f

ActionItem152: adding controller for /profile/*/*


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1252 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/profile_controller.rb 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +class ProfileController < ApplicationController
  2 +end
... ...
config/routes.rb
... ... @@ -43,6 +43,9 @@ ActionController::Routing::Routes.draw do |map|
43 43 # controllers for blocks
44 44 map.controllers 'block/:profile/:controller/:action/:id', :controller => Noosfero.pattern_for_controllers_from_design_blocks
45 45  
  46 + # public profile information
  47 + map.profile 'profile/:profile/:action', :controller => 'profile', :action => 'index'
  48 +
46 49 ######################################################
47 50 ## Controllers that are profile-specific (for profile admins )
48 51 ######################################################
... ...
test/functional/profile_controller_test.rb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +require 'profile_controller'
  3 +
  4 +# Re-raise errors caught by the controller.
  5 +class ProfileController; def rescue_action(e) raise e end; end
  6 +
  7 +class ProfileControllerTest < Test::Unit::TestCase
  8 + def setup
  9 + @controller = ProfileController.new
  10 + @request = ActionController::TestRequest.new
  11 + @response = ActionController::TestResponse.new
  12 + end
  13 +
  14 + # Replace this with your real tests.
  15 + def test_truth
  16 + assert true
  17 + end
  18 +end
... ...
test/integration/routing_test.rb
... ... @@ -93,4 +93,9 @@ class RoutingTest &lt; ActionController::IntegrationTest
93 93 assert_routing('/tag/umboraminhaporra', :controller => 'search', :action => 'tag', :tag => 'umboraminhaporra')
94 94 end
95 95  
  96 + def test_profile_routing
  97 + assert_routing('/profile/ze', :controller => 'profile', :profile => 'ze', :action => 'index')
  98 + assert_routing('/profile/ze/friends', :controller => 'profile', :profile => 'ze', :action => 'friends')
  99 + end
  100 +
96 101 end
... ...