Consider not putting any data in your Gherkin that determines HOW something is done. For example you could write
When "I visit '/login' and login"
and capture the path in a param and then use that to login. However if HOW you login changes, lets say we use `/signin` instead you will have to change your scenario.
However if you write your scenario so it only tells you WHAT you are doing as in
When "I login"
and keep the information about how you do things in the step definitions or better yet helper methods that the step definitions use, then you scenarios can remain unchanged.
When "I login" do
login user: @i
end
module LoginStepHelper
def login(user:
visit login_path
...
end
end
World LoginStepHelper
Once you push the HOW down into helper methods you can easily be DRY and use all the functionality a programming language provides to solve this problem.