用黄瓜和泡菜记录 id [Rails]
我结合使用 Cucumber、Webrat 和 Pickle。 当我编写场景时,我可以执行以下操作:
Given a product exists with title: "Bread"
When I go to the edit page for that product
And I fill in "Title" with "Milk"
And I press "Save changes"
Then I should see "Successfully edited product."
And I should be on that car's page
注意该产品的。这是pickle 提供的东西,对于引用我正在检查是否存在的产品的记录非常方便。不过,最后一行不起作用。
基本上我试图确保我是该记录的显示页面,但由于我没有它的 ID,所以我不知道如何引用它。
有什么帮助吗? 谢谢!
I am using Cucumber, Webrat, and Pickle in conjunction.
When I write a scenario, I can do something like this:
Given a product exists with title: "Bread"
When I go to the edit page for that product
And I fill in "Title" with "Milk"
And I press "Save changes"
Then I should see "Successfully edited product."
And I should be on that car's page
Notice the for that product
. This is something pickle provides which is very convenient for referencing the record for a product I'm checking the existence of. That last line, though, is not working.
Basically I am trying to make sure I am the show page for that record, but since I do not have an ID for it, I don't know how to reference it.
Any help?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要引用创建的产品或其他任何内容,您可以使用 pickle 提供的命名:
要处理此 url,您需要将几行添加到 /features/support/paths.rb 中:
此外,处理编辑路径也可能很有用对于这样的模型:
paths.rb:
To have a reference to the created product or anything else you can use naming that's provided by pickle:
To handle this url you will need to add couple lines into /features/support/paths.rb:
Also it could be useful to handle edit path for the model like this:
paths.rb: