【问题标题】:Cucumber cannot follow simple link, cannot find path method in Rack Request?Cucumber 无法跟随简单的链接,在 Rack Request 中找不到路径方法?
【发布时间】:2011-12-16 02:14:32
【问题描述】:

我在这上面花了几个小时,我有以下简单的功能:

Feature: New User Registration

  Scenario: A user should be able to create a new account
    Given I am on the homepage
    When I follow "My Account"

当我使用它运行它时

cucumber features/authentication.feature

第 33-36 行的网络步骤如下所示:

When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
  with_scope(selector) do
    click_link(link)
  end
end

我收到以下错误:

/Users/jason/.rvm/gems/ruby-1.8.7-head/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack.rb:17: warning: already initialized constant VERSION

.F

(::) 失败的步骤 (::)

未定义方法path' for #<Rack::Request:0x10577bf40> (NoMethodError) (eval):2:insend' (eval):2:in click_link' ./features/step_definitions/web_steps.rb:35 ./features/step_definitions/web_steps.rb:14:inwith_scope' ./features/step_definitions/web_steps.rb:34:in /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/' features/authentication.feature:5:in当我关注“我的帐户”时'

我正在使用 Ruby 1.8.7、Rails 2.3.2、Capybara 1.1.1 和 cucumber-rails 0.3.2

非常感谢任何帮助,把我的头发拉到这个上面! :)

更新

我通过将 capybara 降级到 1.0.1、卸载 cucumber 并重新安装来解决此问题,它工作正常。希望这可以帮助其他人。

【问题讨论】:

  • web_steps.rb 中的代码是什么样的?也许包含第 35 行的代码块?
  • OP 更新为包含第 33-36 行

标签: ruby-on-rails rubygems cucumber


【解决方案1】:

我通过将 capybara 降级到 1.0.1、卸载 cucumber 并重新安装来解决此问题,它工作正常。希望这可以帮助其他人。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-21
    • 1970-01-01
    • 1970-01-01
    • 2011-09-07
    • 2012-07-16
    • 2012-04-30
    相关资源
    最近更新 更多