I''ve made use of much this code for user authentication: http://www.aidanf.net/rails_user_authentication_tutorial Most of what the user needs to do is controlled by a ''repository_controller'', but when they try to log in it will be dealt with by the ''user_controller''. The test below should represent re-directing them to login, then back to the page originally requested: def test_return_to get :controller => ''repository'', :action => ''view_downloads'' assert flash[:notice] assert_response :redirect assert_redirected_to :action=>''login'' assert @response.has_session_object?(:return_to) post :login, { :username => "bob", :password => "test"} assert_response :redirect assert_redirected_to :controller => ''repository'', :action => ''view_downloads'' assert @response.has_session_object?(:user) end However, the test fails with: response is not a redirection to all of the options supplied (redirection is <{"action"=>"actionview_downloadscontrollerrepository", "controller"=>"user"}>), difference: <{"action"=>"view_downloads", "controller"=>"repository"}> When redirected to ''login'', sesson[:return_to] should be set to request.request_uri. It seems that ''get'' does not do this. Is there a way around that problem? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---