rspeccucumberbundlerrspec2rspec-expectations

rspec: undefined local variable or method `be_true'


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

with step definition:

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)

I am also using bundler to manage my dependencies.

Am I doing something obviously wrong here?

Regards,

Mark


Solution

  • From the cucumber documentation:

    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