黄瓜泡菜的path_to_pickle用法
我只是看看 pickle (在 Rails 3 上)来简化我在 Cucumber 中的步骤和路径。我在使用 path_to_pickle 创建编辑路径时遇到问题。
我安装了pickle:
rails g pickle --paths --email
我有一个编辑分类帐的场景:
Scenario: Edit a ledger
Given I have a ledger with name "Digitech"
When I go to the ledger's edit page
And I fill in "Name" with "Test Ledger"
And I press "Update Ledger"
Then I should be on the ledgers page
And I should see "Ledger was successfully updated."
我正在使用pickle生成的标准路径:
when /^#{capture_model}(?:'s)? page$/ # eg. the forum's page
path_to_pickle $1
when /^#{capture_model}(?:'s)? #{capture_model}(?:'s)? page$/ # eg. the forum's post's page
path_to_pickle $1, $2
when /^#{capture_model}(?:'s)? #{capture_model}'s (.+?) page$/ # eg. the forum's post's comments page
path_to_pickle $1, $2, :extra => $3 # or the forum's post's edit page
when /^#{capture_model}(?:'s)? (.+?) page$/ # eg. the forum's posts page
path_to_pickle $1, :extra => $2 # or the forum's edit page
我在尝试运行cucumber时收到此错误
When I go to the ledger's edit page # features/step_definitions/web_steps.rb:19
Could not figure out a path for ["the ledger"] {:extra=>"edit"} (RuntimeError)
./features/support/paths.rb:32:in `path_to'
./features/step_definitions/web_steps.rb:20:in `/^(?:|I )go to (.+)$/'
features/ledger/manage_ledgers.feature:61:in `When I go to the ledger's edit page'
我在邮件列表上读到path_to_pickle需要注意,但那是在九月份,现在还是这样吗?
我应该使用诸如 polymorphic_path(model($1)) 之类的东西吗?
I'm just having a look at pickle (on Rails 3) for simplifying my steps and paths in cucumber. I'm having trouble using the path_to_pickle for creating edit paths.
I installed pickle with:
rails g pickle --paths --email
I have a Scenario for editing a ledger:
Scenario: Edit a ledger
Given I have a ledger with name "Digitech"
When I go to the ledger's edit page
And I fill in "Name" with "Test Ledger"
And I press "Update Ledger"
Then I should be on the ledgers page
And I should see "Ledger was successfully updated."
I'm using the standard paths which pickle generates:
when /^#{capture_model}(?:'s)? page$/ # eg. the forum's page
path_to_pickle $1
when /^#{capture_model}(?:'s)? #{capture_model}(?:'s)? page$/ # eg. the forum's post's page
path_to_pickle $1, $2
when /^#{capture_model}(?:'s)? #{capture_model}'s (.+?) page$/ # eg. the forum's post's comments page
path_to_pickle $1, $2, :extra => $3 # or the forum's post's edit page
when /^#{capture_model}(?:'s)? (.+?) page$/ # eg. the forum's posts page
path_to_pickle $1, :extra => $2 # or the forum's edit page
I get this error when trying to run cucumber
When I go to the ledger's edit page # features/step_definitions/web_steps.rb:19
Could not figure out a path for ["the ledger"] {:extra=>"edit"} (RuntimeError)
./features/support/paths.rb:32:in `path_to'
./features/step_definitions/web_steps.rb:20:in `/^(?:|I )go to (.+)$/'
features/ledger/manage_ledgers.feature:61:in `When I go to the ledger's edit page'
I read on the mailing list that path_to_pickle needed attention but that was back in September, is this still the case?
Should I be using something like polymorphic_path(model($1))?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终放弃了 path_to_pickle 并使用多态路径。这是我专门为捕获编辑页面而编写的步骤。您可以将“编辑”替换为更通用的解决方案
I ended up giving up on path_to_pickle and using polymorphic path. This is a step I have written for specifically capturing the edit page. You can replace the 'edit' for a more general solution