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