Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong step definition created when having "(" #364

Closed
christianbaumann opened this issue Apr 19, 2018 · 4 comments
Closed

Wrong step definition created when having "(" #364

christianbaumann opened this issue Apr 19, 2018 · 4 comments

Comments

@christianbaumann
Copy link

Summary

I have a step definition which contains "(" and ")", eg.

And the room information (room code and availability) is correct

Expected Behavior

When I run cucumber and have no step definition defined, I would expect a matching step definition to be defined

And(/^the room information (room code and availability) is correct$/) do

Current Behavior

Instead, following step definition is created:

And("the room information (room code and availability) is correct") do

Your Environment

  • Ruby: ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
  • Cucumber:
    cucumber (3.1.0)
    cucumber-core (3.1.0)
    cucumber-expressions (5.0.17, 5.0.15)
    cucumber-tag_expressions (1.1.1)
    cucumber-wire (0.0.1)
  • Operating System and version: Windows 8.1 Enterprise
@aslakhellesoy
Copy link
Contributor

As of 3.0.0.pre.2, cucumber-ruby supports both Cucumber Expressions and Regular Expressions.

Generated snippets use Cucumber Expressions, not Regular Expressions.

I think you may have stumbled upon #333 which should have been fixed by #334, but it looks like there might still be a bug with it.

This needs more investigation....

@aslakhellesoy
Copy link
Contributor

@christianbaumann here is a workaround for you. The generated snippet currently is:

Given("the room information \(room code and availability) is correct") do
  pending # Write code here that turns the phrase above into concrete actions
end

Either change double quotes to single quotes:

Given('the room information \(room code and availability) is correct') do
  pending # Write code here that turns the phrase above into concrete actions
end

Or double-escape the opening parenthesis:

Given("the room information \\(room code and availability) is correct") do
  pending # Write code here that turns the phrase above into concrete actions
end

The bug is in cucumber-ruby, and not in cucumber-expressions. We should change the snippet generator to use single quotes rather than double quotes, and only escape single quotes in the expressions itself.

@aslakhellesoy
Copy link
Contributor

This issue was moved to cucumber/cucumber-ruby#1291

@lock
Copy link

lock bot commented Apr 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants