Posting to a separate controller in a functional test


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?


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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs