Skip to content

Fix double substitutions of example values in Ruby - #697

Open
raviqqe wants to merge 1 commit into
cucumber:mainfrom
raviqqe:bug/gsub-slash-pattern
Open

Fix double substitutions of example values in Ruby#697
raviqqe wants to merge 1 commit into
cucumber:mainfrom
raviqqe:bug/gsub-slash-pattern

Conversation

@raviqqe

@raviqqe raviqqe commented Aug 23, 2026

Copy link
Copy Markdown

🤔 What's changed?

The Ruby implementation now substitutes scenario outline example values literally, using the block form of String#gsub, instead of passing them as replacement patterns.

⚡️ What's your motivation?

Every other implementation already substitutes literally. This is Ruby catching up rather than new behavior.

The second argument of String#gsub is a replacement pattern, not a literal string. Because example values are data, any value holding a backslash before special characters is silently rewritten instead of inserted.

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

No, I don't think so.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@raviqqe raviqqe changed the title Fix double substitutions in Ruby Fix double substitutions of example values in Ruby Aug 23, 2026
@raviqqe
raviqqe marked this pull request as ready for review August 23, 2026 23:12
@mpkorstanje
mpkorstanje requested a review from luke-hill August 31, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant