黄瓜因Nokogiri而失败
我刚刚开始使用 Cucumber,在最简单的情况下,我抛出以下错误:
未定义的方法 has_key?'对于#
/^(?:|I )将“([^”])”填入“([^”]) “$/” features/authentication.feature:9:in `当我用“Joe User”填写“user_name”时'
场景如下...
场景:注册 鉴于我进入注册页面 当我用“Joe User”填写“user_name”时,
这是场景、Cucumber 或 Nokogiri 中的问题吗?有什么解决方案吗?
I just started using Cucumber and in the simplest of scenarios I throw the following error:
undefined method has_key?' for #<Nokogiri::XML::Element:0x10677a400> (NoMethodError)
/^(?:|I )fill in "([^"])" with "([^"])"$/'
./features/step_definitions/web_steps.rb:36:in
features/authentication.feature:9:in `When I fill in "user_name" with "Joe User"'
The Scenario is as follows...
Scenario: Signup
Given I go to the signup page
When I fill in "user_name" with "Joe User"
Is this a problem in the Scenario, Cucumber, or Nokogiri? Any Solutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,这是独家新闻。显然,使用以下 gem 时存在与 webrat 相关的问题:cucumber 0.8.0、cucumber-rails 0.3.2、nokogiri 1.4.2、webrat 0.7.1
我使用以下命令重新配置...
script/generate cucumber --rspec ——水豚
,一切都很快乐。
OK, here's the scoop. Apparently there is some problem related to webrat when using the following gems: cucumber 0.8.0, cucumber-rails 0.3.2, nokogiri 1.4.2, webrat 0.7.1
I reconfigured with the following...
script/generate cucumber --rspec --capybara
and all was happy.
如果您使用 linkedin gem,则会发现这是 ROXML 猴子修补 Nokogiri 的问题。请参阅http://github.com/pengwynn/linkedin/issues#issue/4。您可以通过将其添加到 linkedin/lib/linkedin.rb 来重新猴子修补快速修复:
(source http://github.com/caike/linkedin/commit/011370f5d9d002a140a99a59a09866922ecf969f)
If you are using the linkedin gem, it turns out this is an issue with ROXML monkey-patching Nokogiri. See http://github.com/pengwynn/linkedin/issues#issue/4. You can re-monkey-patch a quick fix by adding this to linkedin/lib/linkedin.rb:
(source http://github.com/caike/linkedin/commit/011370f5d9d002a140a99a59a09866922ecf969f)