【发布时间】:2013-06-22 05:32:40
【问题描述】:
作为我对网站的集成测试的一部分,我使用 cucumber 和 capybara。似乎水豚无法模仿使用 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"
【问题讨论】:
标签: ruby-on-rails cucumber capybara