I have just added Cucumber to my Rails app via the following steps:
Adding
group :test do
gem 'cucumber'
end
to my Gemfile.
Running bundle install
Followed by rails generate cucumber:install
When there are no features, Cucumber seems to run as expected.
But when I add a feature file and run bundle exec cucumber I get the following
uninitialized constant Gherkin::Parser::Parser (NameError)
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/feature_file.rb:34:inparse'block in load’
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:28:in
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:26:ineach'load’
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:26:in
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:14:infeatures'features’
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:170:in
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:46:inrun!'execute!’
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:43:in
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:20:inexecute'‘
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/gems/cucumber-1.2.1/bin/cucumber:14:in
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/bin/cucumber:23:inload'‘
/Users/purinkle/.rvm/gems/ruby-1.9.3-p286@radfords/bin/cucumber:23:in
You probably have some other gem that implements
Gherkin.If you have
spinachinstalled, for example, that will create a conflict: whencucumberrequiresGherkin, it will pull from thespinachgem instead of fromgherkinCucumber‘sGherkin::Parseris a module with aParserclass in it [1].Spinachusesgherkin-ruby[2], which implements the whole thing in a different way, but using the same names [3] (poor implementation IMO).Try uninstalling
spinach(removing it from yourGemfileand abundle updateshould be enough) or whatever you have that might be causing a name clash.