From c95d491c9545c64163088259fd6310fc9b5204d1 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 23 Jan 2008 22:50:31 +0000 Subject: [PATCH] ActionItem152: adding controller for /profile/*/* --- app/controllers/public/profile_controller.rb | 2 ++ config/routes.rb | 3 +++ test/functional/profile_controller_test.rb | 18 ++++++++++++++++++ test/integration/routing_test.rb | 5 +++++ 4 files changed, 28 insertions(+), 0 deletions(-) create mode 100644 app/controllers/public/profile_controller.rb create mode 100644 test/functional/profile_controller_test.rb diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb new file mode 100644 index 0000000..c46b654 --- /dev/null +++ b/app/controllers/public/profile_controller.rb @@ -0,0 +1,2 @@ +class ProfileController < ApplicationController +end diff --git a/config/routes.rb b/config/routes.rb index 9c09ebb..c9920b9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -43,6 +43,9 @@ ActionController::Routing::Routes.draw do |map| # controllers for blocks map.controllers 'block/:profile/:controller/:action/:id', :controller => Noosfero.pattern_for_controllers_from_design_blocks + # public profile information + map.profile 'profile/:profile/:action', :controller => 'profile', :action => 'index' + ###################################################### ## Controllers that are profile-specific (for profile admins ) ###################################################### diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb new file mode 100644 index 0000000..623b592 --- /dev/null +++ b/test/functional/profile_controller_test.rb @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'profile_controller' + +# Re-raise errors caught by the controller. +class ProfileController; def rescue_action(e) raise e end; end + +class ProfileControllerTest < Test::Unit::TestCase + def setup + @controller = ProfileController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 6ed1e61..1eb29a1 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -93,4 +93,9 @@ class RoutingTest < ActionController::IntegrationTest assert_routing('/tag/umboraminhaporra', :controller => 'search', :action => 'tag', :tag => 'umboraminhaporra') end + def test_profile_routing + assert_routing('/profile/ze', :controller => 'profile', :profile => 'ze', :action => 'index') + assert_routing('/profile/ze/friends', :controller => 'profile', :profile => 'ze', :action => 'friends') + end + end -- libgit2 0.21.2