Ruby/Gherkin autocomplete

Hello,

I have installed the newest stable IntelliJ IDEA version and a Ruby 1.8.7 runtime under Windows 7 (64bit). Given a PHP project with a cucumber/gherkin test directory I created a new project (java project) and added the project root as a source directory. This works fine for all php stuff. But when I open up a *.rb (ruby) file there's the message that a "JRuby" facet has been detected. I neglected to create such a facet as I have a native ruby installation and don't want to install JRuby. But now the autocomplete for Ruby files is sort of broken.

I.e. when I input "mod" and press Ctrl+Space it will be completed to "module" correctly. But when I input "req" it won't be completed to "require". (I tested another project and installed JRuby to

Another problem: when I create a "common" cucumber project structure like this one...

+ features
  + steps
    + test1_step.rb
  + support
    + global.rb
  test1.feature


... then if I edit the test1.feature file there will be an autocompletion on the steps defined in global.rb and test1_step.rb. In order to provide a better testing structure that more suitable to bigger suites I created the following structure:

+ features
  + _steps
    + global.rb
  + _support
    + helpers
      + database_helper.rb
      + ...
     + 00_env.rb
    + 01_models.rb
    + ...
  + testsuite1
    + test1.feature
    + test1.step
  + testsuite2
  + ...


Now when I edit test1.feature the steps defined in global.rb will not be provided on autocompletion. Even if I copy the global.rb file to the testsuite1 directory this won't be the case. So did I mess up something or is such a structure not supported by IDEA 10?

Any help would be appreciative. :)
Greetings
- Marcel

3 comments
Comment actions Permalink

Hello Marcel,

you need Ruby module for native ruby support. So, you need to setup ruby module for your step definitions and feature files and setup your native ruby sdk for that module

0
Comment actions Permalink

Hello Dennis,

what do you mean by "module"? There's only the ruby plugin (http://confluence.jetbrains.net/display/RUBYDEV/RubyMine+and+IntelliJ+IDEA+Ruby+Plugin) and yes, I installed it of course.

You wrote about setting up the "module" for the step definitions and feature files... assuming we're talking about the same "module" where can I setup it?

EDIT: aahh, finally got that "module" running :) ... didn't know that I had to "create" a new module inside the project structure (assumed that if there's no Ruby but a JRuby module then the ruby plugin is responsible for the rest)

Nevertheless: the steps aren't recognized in the feature files - what else might I be missing?

Greetings
- Marcel

0
Comment actions Permalink

Omg... IDEA 10 expects step definitions under the exact directory name "step_definitions"! When I create a directory "step_definitions" and put the "global.rb" into it then it will be recognized by the feature files (even if those feature files are in a deeper directory structure)

But furthermore: no step definition that is not a descendent of a directory named "step_definitions" will be recognized. This means that even step definitions that reside in the same directory like the feature file won't be recognized to get the autocomplete for that feature file working.

I also tried adding manual "autocomplete" directories to the module config but that didn't help. Is there any way to accomplish an autocomplete for steps in connection with the given cucumber test structure? (btw: cucumber does NOT require a directory named "step_definitions")

0

Please sign in to leave a comment.