Rodrigo Flores wrote:
Hi
I'm reading the rspec book and I'm having problems when I require the
file 'spec/stubs/cucumber'. When I go to an IRB prompt and type
require 'spec/stubs/cucumber' after requiring another libraries [1] I
get the false in 'spec/expectations' and an error in
'spec/stubs/cucumber'. The error message is [2]. Any ideas? I'm using
rspec 1.2.8.
Thanks in advance
[1]
require 'rubygems'
require 'spec'
require 'spec/expectations'
require 'spec/stubs/cucumber'
[2]
NoMethodError: undefined method `Before' for main:Object
from
/home/rodrigo/.gem/ruby/1.8/gems/rspec-1.2.8/lib/spec/stubs/cucumber.rb:3
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from (irb):9
from :0
That file is only meant to be used when running Cucumber. So you would
place the require in your features/support/env.rb file for example.
Without having Cucumber loaded first the Before method will not be
defined and the above error is expected.
If you are just wanting to play around with rspec matchers in IRB then
the top three requires is all you will need. So, you could say:
require 'rubygems'
require 'spec'
require 'spec/expectations'
42.should == 42
HTH,
Ben
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users