Forum: Ruby on Rails Posting to a separate controller in a functional test

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mitchell H. (Guest)
on 2005-12-30 01:42

I need to post to a controller to log in a user in a functional test,
but I'm not sure what to do to post to a separate controller. I've

post { :controller => :account, :action => :do_login }, { bla bla bla }

But that doesnt seem to have worked. Help?

Sandi Metz (Guest)
on 2005-12-30 21:29
(Received via mailing list)
I had this same problem and managed to post to a different controller by
explicitly setting the @controller variable.

In my home_controller_test.rb, where
  def setup
    @controller =
    @request    =
    @response   =

I had to
    @controller =
    post :login, :user => {:name => name, :password => password}

to get a post to go to the LoginController.

Hope this helps,
This topic is locked and can not be replied to.