What is correct version of Cucumber gem?

I've seen one post that indicates 0.3.7, and other posts refer to 0.5.x. The latest version available is 0.6.x.
I'm running Rubymine 2.0.1, on an Ubuntu 9.10 system, with Rails 2.3.5. Pretty much everything I've tried so far by going through the demos and online documentation, works: except Cucumber testing.
I initially had a problem even getting the "Setup Cucumber Support" menu item to show up. By choosing 0.3.7 I was finally able to get that part to work.
Now, I've encountered problems trying to run any tests because the cucumber script seems to be looking in the wrong location to load cucumber.

Most of my gems are installed in a local directory (e.g. /home/foo/.gem/...), but the script is first looking under vendor/plugins, and if that fails, it uses Gem.bindir - which doesn't take advantage of the gem load paths, and doesn't find the local cucumber. I believe the correct method to use is Gem.bin_path. After making that change, the script is found and run, but I get the following stacktrace when trying to run the tests:

/usr/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /home/jeff/projects/foo/script/cucumber /home/jeff/projects/gtd/features/manage_gtds.feature --format Teamcity::Cucumber::Formatter --expand --color
Testing started at 11:03 PM ...
The path to cucumber is: /home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/cucumber
No such file or directory - /home/jeff/projects/foo/config/environments/cucumber.rb (Errno::ENOENT)
/home/jeff/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:386:in `read'
/home/jeff/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:386:in `load_environment'
/home/jeff/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/home/jeff/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:379:in `load_environment'
/home/jeff/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:137:in `process'
/home/jeff/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
/home/jeff/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/home/jeff/projects/foo/config/environment.rb:9
/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/jeff/.gem/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/jeff/projects/foo/features/support/env.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/jeff/.gem/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/../lib/cucumber/cli/main.rb:81:in `require_files'
/home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/../lib/cucumber/cli/main.rb:79:in `each'
/home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/../lib/cucumber/cli/main.rb:79:in `require_files'
/home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/../lib/cucumber/cli/main.rb:34:in `execute!'
/home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/../lib/cucumber/cli/main.rb:20:in `execute'
/home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/cucumber:8
/home/jeff/projects/foo/script/cucumber:6:in `load'
/home/jeff/projects/foo/script/cucumber:6
-e:1:in `load'
-e:1
Empty test suite.

Process finished with exit code 1

What is supposed to create the cucumber.rb config file? Was the "Setup Cucumber Support" script supposed to create it, and failed silently?

2 comments

I've seen one post that indicates 0.3.7, and other posts refer to 0.5.x. The latest version available is 0.6.x.

Our cucumber support will work with all cucumber versions until they will have break their public API

I initially had a problem even getting the "Setup Cucumber Support" menu item to show up. By choosing 0.3.7 I was finally able to get that part to work.

1. Cucumber support will be enabled only if some "cucumber" gem is attached in RubyMine's RubySDK and Gems settings.
2. According to http://github.com/aslakhellesoy/cucumber/blob/master/History.txt all rails-specific code was moved from cucumber 0.5 to cucumber-rails gem. So cucumber specific generators will be available if you have just cucumber gem v.< 0.5. or if both cucumber v.>=0.5 and cucumber-rails gems are installed.

Press "RM | Tools | Reload Generators" If you installed cucumber or cucumber-rails gems after you had created RubyMine project. It's because some gems (e.g. Cucumber) registers new rails "generators" and you should ask RM to updated cached list of generators

3. Actually "Setup Cucumber Support" is just a presentation of "cucumber" rails generator. The generator creates necessary files in your project for cucumber. RubyMine hides this option if cucumber specific files (e.g. "./scripts/cucumber") were detected in your project.

/home/jeff/projects/gtd/features/manage_gtds.feature --format Teamcity::Cucumber::Formatter --expand --color
Testing started at 11:03 PM ...
The path to cucumber is: /home/jeff/.gem/ruby/1.8/gems/cucumber-0.3.7/bin/cucumber
No such file or directory - /home/jeff/projects/foo/config/environments/cucumber.rb (Errno::ENOENT)
/home/jeff/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:386:in `read'

What is supposed to create the cucumber.rb config file? Was the "Setup Cucumber Support" script supposed to create it, and failed silently?

"Setup Cucumber Support" ("cucumber" rails generator) always creates "config/environments/cucumber.rb" file, so I don't understand why it is missed. Probably RM show some errors after executing the generator and I didn't noticed them.

Most of my gems are installed in a local directory (e.g. /home/foo/.gem/...), but the script is first looking under vendor/plugins, and if that fails, it uses Gem.bindir - which doesn't take advantage of the gem load paths, and doesn't find the local cucumber.

Cucumber script is provided by cucumber gem, so it isn't a RubyMine issue. You should get the same behavior in console.

----
I've just managed to create sample Rails Application in RubyMine 2.0.2 rc. It is a Rails 2.3.5 with cucumber 0.6.4 and cucumber-rails 0.3.0 gems. Also cucumber asked me to install database-cleaner 0.5.0 gem. I launched "Setup Cucumber Support" action, that create a model with one field using Scaffold generator and simple cucumber test for it using Feature generator. Then I launched my manage_cats.feature file from context menu and got nice green/read output in test runner results window.

0

Thanks for the great information, Roman (as usual :-). I'll update to Rubymine 2.0.2rc, install the latest cucumber and associated gems, and try again....

0

Please sign in to leave a comment.