RESTFUL Authentification plugin Functional tests - howto ?

I am trying to write a functional test of my UserController index action

require File.dirname(__FILE__) + '/../test_helper' require 'users_controller'

class UsersControllerTest < Test::Unit::TestCase   def setup     @controller = UsersController.new     @request = ActionController::TestRequest.new     @response = ActionController::TestResponse.new   end

def test_should_get_index     login_as (:superadmin)     get :index     assert_response :success     assert_not_nil assigns(:users)     assert_equal 15, assigns(:users).total_entries

    login_as (:quentin)     get :index     assert_response :success     assert_not_nil assigns(:users)     assert_equal 6, assigns(:users).total_entries   end end

I am using the Restful Authentification plugin, without any problem running my index action

class UsersController < ApplicationController before_filter :login_required   def index    @roles = ....   @users = User.display_users(current_user, @roles, params[:page]) ...   end ... end

on the first login_as (:superadmin), it's OK, current_user is 1, but when doing the login_as (:quentin), the current_user is NOT modified, still being 1

I wrote in the login_as in : module AuthenticatedTestHelper   # Sets the current user in the session from the user fixtures.   def login_as(user)     @request.session[:user_id] = user ? users(user).id : nil   end ... end

the @request.session[:user_id] is correctlt modified (user_id 1, then user_id 2) but current_user in my index action is not... where could be the problem located ??

thanks a lot to any info !

erwin