为什么我得到“未定义的方法或变量'example'”?在RSpec 3.0中? [英] Why do I get "undefined method or variable 'example'" in RSpec 3.0?

查看:56
本文介绍了为什么我得到“未定义的方法或变量'example'”?在RSpec 3.0中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到RSpec 3.0后,我收到以下消息:

After upgrading to RSpec 3.0, I got the following message:

 Failure/Error: Unable to find matching line from backtrace
 NameError:
   undefined local variable or method `example' for #<RSpec::ExampleGroups::Anonymous:0x007f9ae985b548>

即使将规范降低为以下内容,消息仍然存在:

The message persisted even after reducing the spec to the following:

describe "" do
  it "" do
  end
end

我确实注意到水豚位于栈顶附近,如下所示:

I did notice capybara was near the top of the stack, as follows:

 # /Users/palfvin/.rvm/gems/ruby-2.0.0-p247@botmetrics/gems/capybara-2.1.0/lib/capybara/rspec.rb:20:in `block (2 levels) in <top (required)>'

的情况下。

推荐答案

此错误是由于在继续运行Capybara 2.1.0的同时安装RSpec 3.0.0.beta引起的。如果安装Capybara 2.2.0.beta,错误将消失。

This error results from installing RSpec 3.0.0.beta while continuing to run Capybara 2.1.0. If you install Capybara 2.2.0.beta, the error will go away.

这篇关于为什么我得到“未定义的方法或变量'example'”?在RSpec 3.0中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆