I am trying use Rspec to test our authentication, this requires me to set a cookie and pass it in the header. when I inspect the headers the cookie is blank Any ideas why this is not working? --- The Spec it "should redirect to overview page if exists" do get ''login'' request.session_options[:session_key].should =''_CRS_session_id'' request.session_options[:secret].should_not == nil cookie = request.session_options[:session_key] + ''='' + request.session_options[:secret] headers = { ''cookie'' => cookie, ''Referer'' => ''http://localhost:3000/auth/login'', ''Content-Type'' => ''application/x-www-form-urlencoded'' } post(''login'', {:username => ''test'', :password => ''password''}, headers) puts response.headers["cookie"].inspect puts request.inspect response.should redirect_to(controller => ''profiles'', :action => ''overview'') end -- Controller method for login def login if request.method == :post && !cookies[''_CRS_session_id''] flash[:auth_error] = :cookies_off elsif request.method == :post && params[:login_form] username = params[:login_form][:username] password = params[:login_form][:password] ldap_authenticate(username, password) end end --- HTTP RESPONSE {"Status"=>"200 OK", "ETag"=>"\"4ff001373a428161bc75da425b5dc4be\"", "X-Runtime" =>"0.00010", "type"=>"text/html; charset=utf-8", "cookie"=>[], "Cache-Control"=> "private, max-age=0, must-revalidate", "Content-Length"=>8140} --- HTTP REQUEST #<ActionController::TestRequest:0xf2d026c @session=#<ActionController::TestSessi on:0xf2c0a24 @attributes=nil, @session_id="", @saved_attributes={"cookie"=>"_CRS _session_id=2887ccde4594cb37332cce1c974962957cf9e102b38155067f175cefbc633e26547c b4e17c9710a71cf39288560d88a9b8b4b707610c9afddswer5530640", "Referer"=>"http: //localhost:3000/auth/login", "Content-Type"=>"application/x-www-form-urlencoded "}>, @path=nil, @accepts=nil, @user_agent="Rails Testing", @env={"REMOTE_ADDR"=> "0.0.0.0", "REQUEST_URI"=>"/auth/login", "SERVER_PORT"=>80, "REQUEST_METHOD"=>"P OST"}, @session_options={:session_key=>"_CRS_session_id", :secret=>"2887ccde45 94cb37332cce1c974962957cf9e102b38155067f175cefbc633e26547cb4e17c9710a71cf3928856 0d88a9b8b4b707610c9afddswer5530640"}, @cookies={}, @request_method=:post, @req uest_parameters={:username=>"test", :password=>"password"}, @request_uri=nil, @symb olized_path_parameters={:action=>"login", :controller=>"auth"}, @query_parameter s={"action"=>"login"}, @path_parameters={"action"=>"login", "controller"=>"auth" }, @content_type=nil, @parameters={"username"=>"test", "action"=>"login", "cont roller"=>"auth", "password"=>"password"}, @host="test.host"> ... I''ve been struggling with this for ages so any input will be greatly appreciated. I''ve also looked at mocks and could not get that to work. Kevin. -- 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 -~----------~----~----~----~------~----~------~--~---