Posting to a separate controller in a functional test

Hi,

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
tried:

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

But that doesnt seem to have worked. Help?

Mitch

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 = HomeController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end

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

to get a post to go to the LoginController.

Hope this helps,
Sandi