【发布时间】: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:inclick_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