Skip to content

fix: address presenter spec flake from Faker apostrophe in flat#2696

Merged
mroderick merged 2 commits into
masterfrom
fix/address-presenter-flake
Jul 9, 2026
Merged

fix: address presenter spec flake from Faker apostrophe in flat#2696
mroderick merged 2 commits into
masterfrom
fix/address-presenter-flake

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Problem

"escapes HTML in address elements" test in AddressPresenter flakes on CI when Faker generates a street name with an apostrophe (e.g. "O'Kon Land", "D'Amore Mill").

The expected value used address.flat, address.city, and address.postal_code raw (unescaped), but the presenter applies ERB::Util.html_escape to all fields. An apostrophe gets escaped to ', causing a mismatch.

Change

Use html_escape for all components in the expected value of the XSS test, consistent with the first test in the same describe block. Only the expected-value construction changed — test intent is unchanged.

Verification

  • bundle exec rspec spec/presenters/address_presenter_spec.rb --seed 44342 passes
  • 10x random-seed runs pass locally

The "escapes HTML in address elements" test hardcoded flat, city, and
postal_code raw in the expected value, but the presenter escapes all
fields through ERB::Util.html_escape. When Faker generates a street
name containing an apostrophe (e.g. O'Kon Land), html_escape converts
it to ' causing a mismatch.

Now uses html_escape for all components in the expected value,
consistent with the first test in the same describe block.
@mroderick mroderick marked this pull request as ready for review July 9, 2026 07:38
@mroderick mroderick enabled auto-merge July 9, 2026 07:38
@mroderick mroderick merged commit 66acd28 into master Jul 9, 2026
8 checks passed
@mroderick mroderick deleted the fix/address-presenter-flake branch July 9, 2026 08:45
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.

2 participants