Cucumber Quick Fix doesn't extract variables
I am using the Quick Fix feature (Alt-Enter) on a Step in a Scenario Outline in a Cucumber feature file to auto-create the Ruby step definition. The Step looks something like:
Given a driver: <name>, <address>, <phone_number>
When I use Quick Fix I get the following code:
Given /^a driver: <name>, <address>, <phone_number>$/ do
pending
end
What I expected to see was:
Given /^a driver: (.*), (.*), (.*)$/ do | name, address, phone_number |
pending
end
Is there a reason why Quick Fix doesn't audiomagically extract the variables? Am I missing a configuration setting somewhere?
Thanks!
Paul
请先登录再写评论。
Hello Paul,
Good suggestion. At the moment our snippets generator behaves like cucumber gem. Although "<" and ">" looks like scenario outline and probably better to generate sections in "Examples" table. By the way
{code}
Given a driver: "name", "address", "phone_number"
{code}
will generate step definition almost the same as you expect.
Thanks for the quick reply... your code snippet *almost* works... I changed it to:
Given a driver: "<name>", "<address>", "<phone_number>"
Note the addition of the angle brackets. Without them, RubyMine correctly grays out the Examples section of the Scenario Outline as there are no valid parameters.
Thanks again. That works like a charm!
Oh, no. It seems we haven't understood each other. I don't suggest such direction =) I meant that angle brackets are usually used as parameters in scenarious outlines. Thus more reasonable implement a quickfix which generates a new column in Exmaples group for text in angle brackets or smth like this.
Our quickfix is expected to generate the same snippet because at the moment we reuse snippet text generator provided by cucumber. As for more friendly args names - sound reasonable, please submit an issue. It seems we also do some redundant escaping for double quote and it is a bug.
Yes, the are necessary according to Cucumber feature syntax
Nice to hear it, thanks!
P.S: It seems that I accidentally deleted your previous post or may be you edited it.
Yes, I severely edited my post as I had gone off in an entirely wrong direction. Sorry about that! Once I actually followed the Cucumber directions things worked as expected.
Thanks again, for creating such an excellent Ruby/Rails/Cucumber/etc. IDE! :-D