rspec:undefined局部变量或方法`be_true' [英] rspec: undefined local variable or method `be_true'
本文介绍了rspec:undefined局部变量或方法`be_true'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用rspec 2.4.0和黄瓜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
以下问题:
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?
请注意,
p>
推荐答案
从黄瓜文档中:
要使用RSpec的2.xx期望(应该),请确保以下是
在功能/ 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:undefined局部变量或方法`be_true'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文