作为我对网站的集成测试的一部分,我将黄瓜与水豚一起使用。水豚似乎无法模仿 cookie 的使用。
例如,我在用户登录时设置了 cookie:
def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.salt]
current_user = user
end
但是,当我稍后使用 cookies.inspect 获取 cookie 的值时,它会返回 {} 这是水豚的已知限制吗?如果是这种情况,我如何通过多个请求测试登录用户?
我应该添加我的测试:
Scenario: User is signed in when they press Sign In
Given I have an existing account with email "bob@jones.com" and password "123456"
And I am on the signin page
When I fill in "Email" with "bob@jones.com"
And I fill in "Password" with "123456"
And I press "Sign In"
Then I should see "Welcome Bob Jones"