I want to reuse some Cucumber steps but can\'t seem to find the right way.
I want to write a step like:
Given /^I login with (.*) credentials$/ |type
Best wrap your steps in %{} rather than quotes. Then, you don't need to escape double quotes which you'll need to use frequently.:
Given /^I login successfully$
step %{I login with valid credentials}
end
Given /^I login with (.*) credentials$/ |type|
# do stuff with type being one of "invalid" or "valid"
end