views:

420

answers:

1

I'm trying a basic RSpec / Cucumber tutorial given here

However, when I run the command "script/cucumber features", I get the following error and am not able to proceed further.

Using the default profile...
uninitialized constant Spec::Example (NameError)
/home/badal/NetBeansProjects/blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:442:in `load_missing_constant'
/home/badal/NetBeansProjects/blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:77:in `const_missing'
/usr/lib/ruby/1.8/spec/interop/test/unit/testcase.rb:23
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `polyglot_original_require'
/home/badal/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in `require'
/home/badal/NetBeansProjects/blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:155:in `require'
/usr/lib/ruby/1.8/spec/interop/test.rb:4
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `polyglot_original_require'
/home/badal/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in `require'
/home/badal/NetBeansProjects/blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:155:in `require'
/var/lib/gems/1.8/gems/rspec-1.3.0/lib/spec/test/unit.rb:1
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `polyglot_original_require'
/home/badal/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in `require'
/home/badal/NetBeansProjects/blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:155:in `require'
/var/lib/gems/1.8/gems/rspec-rails-1.3.2/lib/spec/rails.rb:13
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `polyglot_original_require'
/home/badal/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in `require'
/home/badal/NetBeansProjects/blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:155:in `require'
/var/lib/gems/1.8/gems/cucumber-rails-0.2.4/lib/cucumber/rails/rspec.rb:3
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `polyglot_original_require'
/home/badal/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in `require'
/home/badal/NetBeansProjects/blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:155:in `require'
/home/badal/NetBeansProjects/blog/features/support/env.rb:11
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `polyglot_original_require'
/home/badal/.gem/ruby/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:70:in `require'
/var/lib/gems/1.8/gems/cucumber-0.6.2/bin/../lib/cucumber/rb_support/rb_language.rb:124:in `load_code_file'
/var/lib/gems/1.8/gems/cucumber-0.6.2/lib/cucumber/step_mother.rb:84:in `load_code_file'
/var/lib/gems/1.8/gems/cucumber-0.6.2/lib/cucumber/step_mother.rb:76:in `load_code_files'
/var/lib/gems/1.8/gems/cucumber-0.6.2/lib/cucumber/step_mother.rb:75:in `each'
/var/lib/gems/1.8/gems/cucumber-0.6.2/lib/cucumber/step_mother.rb:75:in `load_code_files'
/var/lib/gems/1.8/gems/cucumber-0.6.2/lib/cucumber/cli/main.rb:48:in `execute!'
/var/lib/gems/1.8/gems/cucumber-0.6.2/lib/cucumber/cli/main.rb:20:in `execute'
/var/lib/gems/1.8/gems/cucumber-0.6.2/bin/cucumber:8
script/cucumber:9:in `load'
script/cucumber:9

The gems installed are as follows:

aaronp-frex (1.0.1)
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
brynary-webrat (0.4.0)
builder (2.1.2)
cucumber (0.6.2)
cucumber-rails (0.2.4)
database_cleaner (0.4.3)
diff-lcs (1.1.2)
json_pure (1.2.0)
nokogiri (1.4.1)
polyglot (0.2.9)
rack (1.1.0, 1.0.1)
rack-test (0.5.3)
rails (2.3.5)
rake (0.8.7)
rspec (1.3.0)
rspec-rails (1.3.2)
rubygems-update (1.3.5)
term-ansicolor (1.0.4)
treetop (1.4.3)
webrat (0.7.0)

I'm using: ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]

Any clues? TIA.

+1  A: 

OK ... I finally figured it out.

The problem was that in addition to the rails (2.3.5) that was installed as a gem, I also had rails (2.3.2) installed using "sudo apt-get install" on Ubuntu. This was causing a mismatch and leading to compilation problem with cucumber (in addition to that it was also causing problems with RubyMine and IntelliJ IDEA).

The solution:

  1. Remove rails 2.3.2 using the synaptic package manager
  2. Create a symlink to the rails gem "sudo ln -s /var/lib/gems/1.8/bin/rails /usr/bin/rails"

And now you are up and running!! Hurray!!

Now running script/cucumber works fine!!

Gur Kamal Singh Badal