Cucumber step completion not working

Cucumber step completion in my features was working fine up until last night.  When I cranked up Rubymine today though, the cucumber editor doesn't recognize any of my step definitions, though it'll run them ok when I supply the default profile (i.e. 'cucumber -p default') on the command arguments.  This happened with another project I had as well--worked fine for awhile, then stopped recognizing the steps.  The first time I thought i'd fiddled with something I shouldn't have in the settings, but this time I want to track it down.  Anyone else seen something like this, or can tell me where to go to fix it?

I'm using Rubymine b. 1283, java 1.6, ruby 1.8.7, and I've got cucumber as a submodule under vendor/plugins, using their latest tag.  (If I don't vendor cucumber, cucumber integration doesn't work at all, but that's a topic for another discussion...)

9 comments
Comment actions Permalink

Ok, I've figured this out:  if you move your features into subfolders under 'features/' then cucumber or rubymine (don't know which) isn't smart enough to pick up the step definitions relative to the new location of the feature file.  The fix is to edit configurations, default configuration for Cucumber, and add "-r features/support -r features/step_definitions" to the script runner options, and set the home directory if its not already set.  previously, i had "-p default" in there, which is why cucumber worked fine when I actually ran the tests (my "-r <dir>" options were in the cucumber.yml file in the root of my project), but rubymine wasn't quite smart enough to open up that file and load the options within.

0
Comment actions Permalink

Hi Keith,

Thank you for you suggestion. Have I understood the structure of your project? You have something like this:

|root
|-features
   |-step_definitions
   |- feature1
   |-....
   ...
   |-folder1
      |- step_definitions
      |- feature1_1
      |- ...
    |-folder2
      |- step_definitions
      |- feature2_1
      |- ...
    |...



0
Comment actions Permalink

That's correct, except that we use a single step_definitions folder beneath the features/ directory instead of one for each submodule (so that we can share steps).

so:

root
|-features
   |-step_definitions
   |- feature1
   |-....
   ...
   |-folder1
      |- feature1_1
      |- ...
    |-folder2
      |- feature2_1
      |- ...
    |...
0
Comment actions Permalink

Ok, I've figured this out:  if you move your features into subfolders under 'features/' then cucumber or rubymine (don't know which) isn't smart enough to pick up the step definitions relative to the new location of the feature file.  The fix is to edit configurations, default configuration for Cucumber, and add "-r features/support -r features/step_definitions" to the script runner options, and set the home directory if its not already set.  previously, i had "-p default" in there, which is why cucumber worked fine when I actually ran the tests (my "-r <dir>" options were in the cucumber.yml file in the root of my project), but rubymine wasn't quite smart enough to open up that file and load the options within.

I'm working with a ruby project setup like

+ project
  + features
     + step_definitions
        + given
           + scenario_specific_folder

              - scenario_steps.rb
           + another_scenario_specific_folder
              - more_scenario_specific_steps.rb
        + when
        + then



And, it RubyMine doesn't pick up the step definitions in the subfolders either.

Could you elaborate on the fix you describe?

edit configurations, default configuration for Cucumber, and add "-r features/support -r features/step_definitions" to the script runner options


I couldn't find a 'configurations' section in the preferences menu. Is this a file that has to be manually edited? If so, where would it be?

Regards,

Jonathon Padfield

0
Comment actions Permalink

Hello Jonathon,
We've added support for step definitions located in subfolders. Fix will be available soon in our next EAP.

0
Comment actions Permalink

Roman.Chernyatchik wrote:

Hello Jonathon,
We've added support for step definitions located in subfolders. Fix will be available soon in our next EAP.


Just tried in in the new EAP build, and it works great! Thanks!

-Jon

0
Comment actions Permalink

Righteo

We have the following:

|root

|-spec_shared

   |-step_definitions

|-project_1

   |-features

        |-step_definitions

        |-feature_1

        |-feature_2

        |-...

|-project_2

   |-features

        |-step_definitions

        |-feature_1

        |-feature_2

        |-...

|-project_3

   |-features

        |-step_definitions

        |-feature_1

        |-feature_2

        |-...

Our features reference local step_definitions and the shared step_definitions at the root of the repository. Is there a way to reference all of those in RubyMine so that the step completion works correctly?

Nick

0
Comment actions Permalink

Hi Nick,

RubyMine doesn't support such use case. I've created an issue - http://youtrack.jetbrains.net/issue/RUBY-5340. Thank you for feedback.

0
Comment actions Permalink

Nick,

I've found a workaround. I've created symlink project_1/features/step_definitions/shared_definitons, which points on spec_shared/step_definitions folder. Then reloaded project_1 in RubyMine and all is ok. But in general I recommend avoid frequent symlinks using. As far as I know RubyMine doesn't fully support it but I don't remember any details.

0

Please sign in to leave a comment.