You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strings for the arguments passed to steps are mutable string objects. So if I change one then that change persists across all future calls to the step.
The ${placeholder} will be replaced by the value of @some_value the first time this step is run, and it keeps the same value forever after, even if @some_value is different for future test.
The simple workaround for this is not to modify the string, for example:
...but I keep making this mistake, and cucumber could certainly be more clever about this, and arguably should be.
The simple solution is just for cucumber to freeze the strings it uses. This will make my call to gsub! throw an error.
A slightly nicer solution might be to clone the strings when passing them into the steps.
I have had a look at the cucumber code to try and write a test and fix for this but I can't really see where this ought to go, so am submitting an issue instead. If someone can give me some pointers into the code I'll happily create a pull request.
The text was updated successfully, but these errors were encountered:
Strings for the arguments passed to steps are mutable string objects. So if I change one then that change persists across all future calls to the step.
For example:
The ${placeholder} will be replaced by the value of @some_value the first time this step is run, and it keeps the same value forever after, even if @some_value is different for future test.
The simple workaround for this is not to modify the string, for example:
...but I keep making this mistake, and cucumber could certainly be more clever about this, and arguably should be.
The simple solution is just for cucumber to freeze the strings it uses. This will make my call to gsub! throw an error.
A slightly nicer solution might be to clone the strings when passing them into the steps.
I have had a look at the cucumber code to try and write a test and fix for this but I can't really see where this ought to go, so am submitting an issue instead. If someone can give me some pointers into the code I'll happily create a pull request.
The text was updated successfully, but these errors were encountered: