我安装设备后其他 Cucumber 测试失败
我安装了 Devise,但我所有的 Cucumber 测试现在都失败了,因为我要求用户登录。这是有道理的。
有没有一种方法可以指定用户登录而不需要经历这样的情况:
> Scenario: Create Issue
> Given I am on the home page
> When I fill in "Email" with "[email protected]"
> And I fill in "Password" with "secret"
> And I press "Sign in"
> Then I am on the list of issues
我尝试了类似以下的操作:user_signed_in? = true
但这失败了。请帮忙。
I installed Devise, and all of my cucumber tests are now failing because I require the user to login. This makes sense.
Is there a way to specify that a user is logged in WITHOUT going through a senario such as this:
> Scenario: Create Issue
> Given I am on the home page
> When I fill in "Email" with "[email protected]"
> And I fill in "Password" with "secret"
> And I press "Sign in"
> Then I am on the list of issues
I tried something like the following: user_signed_in? = true
but this fails. Help please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如本指南中所示,您可以将将该代码放入多个匹配器中以帮助减少重复。更具体地说,我会查看
Given /^I am a new,nauthenticated user$/ do
块。As seen in this guide, you can factor out that code into multiple matchers to help reduce duplication. More specifically I'd look at the
Given /^I am a new, authenticated user$/ do
block.