黄瓜泡菜的path_to_pickle用法

发布于 2024-10-21 08:17:36 字数 1720 浏览 2 评论 0原文

我只是看看 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

屋檐 2024-10-28 08:17:36

我最终放弃了 path_to_pickle 并使用多态路径。这是我专门为捕获编辑页面而编写的步骤。您可以将“编辑”替换为更通用的解决方案

when /^the edit page for #{capture_model}$/ 
  polymorphic_path(model!($1), :action => "edit")

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

when /^the edit page for #{capture_model}$/ 
  polymorphic_path(model!($1), :action => "edit")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文