简体   繁体   中英

Go to cucumber step definition in Spacemacs throws an exception: “Can not load such file — gherkin”

I have a ruby on rails project with feature specs written on cucumber and I am trying to set-up feature mode in my Spacemacs(Emacs) in order to be able to go to a cucumber step definition. In the project, we are using gherkin version 4.0, and I believe, the reason for my error could be that I need to instal another version of gherkin, that the Spacemacs feature mode could work properly. Nevertheless, at the same time, I need to have 4.0 version also installed for the project.

I have tried installing gherkin version 4.0 with bundler from Gemfile locally: bundle install and installing gherkin version 2.11.8 globally with gem install command: gem install gherkin -v 2.11.8

Unfortunately, didn't help :(

Stack: ruby, erb, rails, cucumber, rspec, spacemacs (emacs),

I was suffering from the same issue and found that the lower bound on the gem version for Gherkin in feature-mode/support/find_step.rb is not sufficient. Newer versions of Gherkin seem to cause an exception to be thrown. My hacky workaround is the following:

first install this version of gherkin

gem install gherkin --version 2.11.8

then in spacemacs do the following command:

spc h d p feature-mode

open the package and navigate to support/find_step.rb

change
gem 'gherkin', '>= 2.11.8'
to
gem 'gherkin', '2.11.8'

save the file, and the feature-goto-step-definition function should work again

The package might no longer be maintained and needs a home.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM