Cucumber: Can no longer jump to generated step definitions after moving from 3.2 -> 3.2.4

My Problem
Steps that I have wrriten that use regex's with evaluation in them can no longer be jumped to from a feature file.

When writing my scenarios I am using the concept of personas. That is, I have a fictious character to embody each catagory of user that use my system. My scenarios use these personas to setup data and drive assertions.

What I used to do:

example.feature
Given Leon does something

my_steps.rb
Given /^(Leon|Fred) does something$/ do |name|
    persona = Persona['name']
    persona.do_something
end

The following example was a test would fail if I used an unsupported persona name. The problem with it was that as I added more personas I had go through all my steps and update the regexs. Also I had the same line at the start of every step definitions, i.e. the line to find the persona using the name passed in to the step.

What I do now.


my_steps.rb
Persona.each do |persona|
    Given /#{persona} does something$/ do
          persona.do_something
    end
end


I now loop through my personas generating a unique step for each name. This allows me to manage my personas and not have to update my steps. Also thanks to blocks, and Ruby being awesome, I have access to the persona object and don't have to look it up all the time before calling a method on it. This small change has made a big difference to my productivity and also means that when autocompleting steps in the feature file I don't a regex that is truncated during a long list of names...


Summary
In version 3.2 of the ruby plugin, it used to allow me to jump from a feature file to a step declared in my new style. Version 3.2.4 seems to be a lot stricter and no longer allows me to jump from a feature file to steps written using regex's evaluated at runtime...

I don't know if this change was intentional but in doing so it has removed a really useful feature of 3.2's approach of linking steps to their definition.

Thanks for your help,
Leon

P.S. Sorry for the repeat postings... I don't know what happened there. I've tried to delete them but they don't seem to be disappearing

5 comments

Bump...

Any news on this? I am rolling back to version 3.2 of the Ruby plugin which fixes me for now...

0

I'm getting the samething. Pretty annoying!

0

Hello, Leon.

I've created an issue. And I have just found out the problem, we will fix it soon.

--
Best regards
Andrey Vokin

0

Thanks Andrey! will be really good to see this one fixed :)

0

Thanks for fixing this issue. I can confirm that I am using the newest version of the Ruby plugin with Idea 11 and I am not seeing the issue anymore.

Thanks!

0

Please sign in to leave a comment.