I figured out the problem... thought I would put it on here in case 
anyone else had the same issue.

  fixtures :special_ownerships, :users, :roles, :users_roles

  def setup
    @controller = Administer::SpecialOwnershipsController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new

    # Login User
    @request.session[:user] = User.find(1)
  end

I believe that my problem was not having fixtures for :roles and 
:user_roles set up correctly.

Brandon Hoult wrote:
> I am having the exact same issue, but could not find any information on 
> how to "place a User object in the test session directly".  I tried 
> doing the following in my test, but it still wants to redirect to the 
> login page:
> 
> user = User.find(2)
> @request.session['user'] = user
> 
> Any ideas?
> 
> James Adam wrote:
>> I'm not sure that you can send requests to 'other' controllers in
>> Rails' functional testing at the moment (I believe that the upcoming
>> integration testing is going to cover that).
>> 
>> If you want to test the user login controller, you would need to set
>> the @controller instance variable to be a UserController object.
>> 
>> In most cases like this, it is sufficient to simply place a User
>> object in the test session directly, rather than log in via an actual
>> controller. There have been quite a few posts about this to the mail
>> Rails list over the past month or so; a trip to Google should find
>> them fairly quickly.
>> 
>> HTH
>> 
>> - james
>> 
>> On 3/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>>
>>>   fixtures  :permissions, :users, :roles
>>>   # Replace this with your real tests.
>>>     post :controller => 'user', :action => 'login', :user => {:login =>
>>> to RAILS testing.  I'd appreciate any help.
>>>
>>>
>> 
>> 
>> --
>> * J *
>>   ~


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
engine-users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org

Reply via email to