Created
August 22, 2013 11:15
-
-
Save basti1302/6305970 to your computer and use it in GitHub Desktop.
Use an optional parameter in Cucumber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Optional parameter | |
Scenario: Use an optional parameter | |
When I execute a step | |
When I execute a step with the optional parameter whatever |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I execute a step(?: with the optional parameter (.*))?$/ do |param| | |
param ||= "default value" | |
puts 'using ' + param | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Optional parameter | |
Scenario: Use an optional parameter | |
When I execute a step | |
using default value | |
When I execute a step with the optional parameter foobar | |
using foobar | |
1 scenario (1 passed) | |
2 steps (2 passed) | |
0m0.047s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow. You realize this gist is 7 years old? I don't use cucumber anymore these days. I wonder if that still works :-)