rspec:未定义的局部变量或方法“be_true" [英] rspec: undefined local variable or method `be_true'
本文介绍了rspec:未定义的局部变量或方法“be_true"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 rspec 2.4.0 和 cucumber 0.6.4.我正在运行一个简单的场景(为了这个问题):
I am using rspec 2.4.0 and cucumber 0.6.4. I am running a simple scenario (for the sake of this question):
Scenario: Simple Test
When I test something
带步骤定义:
require 'rspec'
require 'rspec/expectations'
When /^I test something$/ do
result = (1==1)
result.should be_true
end
当我运行这个场景时,我遇到了以下问题:
When I run this scenario I get the following problems:
undefined local variable or method `be_true' for #<Object:0x1b3b424> (NameError)
我也在使用 bundler 来管理我的依赖项.
I am also using bundler to manage my dependencies.
我在这里做错了什么吗?
Am I doing something obviously wrong here?
问候,
标记
推荐答案
来自黄瓜文档:
要使用 RSpec 的 2.x.x 期望(应该),请确保以下内容是在 features/support/env.rb 中:
To use RSpec’s 2.x.x expectations (should), make sure the following is in features/support/env.rb:
require 'rspec/expectations'
World(RSpec::Matchers)
https://github.com/cucumber/cucumber/wiki/RSpec-Expectations
这篇关于rspec:未定义的局部变量或方法“be_true"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文