7
當我登錄到我的應用程序服務器發送我回餅乾(證書和一些應用程序的Cookie):測試響應餅乾
Response sent 170 bytes of Cookie data:
Set-Cookie: user_credentials=val; path=/; HttpOnly; Secure
Response sent 554 bytes of Cookie data:
Set-Cookie: _app_session=otherVal; path=/; HttpOnly; Secure
...,然後重定向到主頁;
Cookie包含一些標誌:例如: httpOnly
,Secure
等
如何測試cookies是否包含Rspec的標誌?
至少在哪裏可以找到這些餅乾?
it "should generate cookies with proper flags" do
params = Factory.attributes_for(:user,
:username => "uname",
:password => "upass"
)
# login
post 'create', params
response.should redirect_to home_url # => pass
puts "response cookie = #{response.cookies.inspect}" # => {} // no cookies in response, why?
end
嗯..其實'水豚'是超出我的工作範圍,但仍然謝謝; – ted
餅乾怎麼設置呢?你是否在控制器中這樣做? – severin
其中一個是由'Authlogic'創建的,另一個是'ActionController',我相信 – ted