作为我网站集成测试的一部分,我正在使用水豚黄瓜。似乎水豚不能模仿使用cookies。黄瓜测试中使用水豚的饼干
比如我设置cookie时,在用户登录:
def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.salt]
current_user = user
end
然而,当我后来取使用cookies.inspect返回{} 是饼干的价值这一个已知的水豚的限制?如果是这种情况,我如何测试多个请求的登录用户?
我要补充我的测试:
Scenario: User is signed in when they press Sign In
Given I have an existing account with email "[email protected]" and password "123456"
And I am on the signin page
When I fill in "Email" with "[email protected]"
And I fill in "Password" with "123456"
And I press "Sign In"
Then I should see "Welcome Bob Jones"
非常好。 我不知道你是否需要这个,但如果你只是使用机架测试以下应该让你设置任何头。 Capybara.current_session.driver.options || = {} Capybara.current_session.driver.options [:headers] || = {} Capybara.current_session.driver.options [:headers] [...] =。 .. – 2011-11-15 20:19:03
这家伙有这个代码的宝石。 https://github.com/nruth/show_me_the_cookies – 2012-09-12 20:59:05