Skip to content

fix: eliminate flaky address presenter test due to unescaped HTML entities#2674

Open
mroderick wants to merge 1 commit into
masterfrom
fix/flaky-address-presenter-test
Open

fix: eliminate flaky address presenter test due to unescaped HTML entities#2674
mroderick wants to merge 1 commit into
masterfrom
fix/flaky-address-presenter-test

Conversation

@mroderick

@mroderick mroderick commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Problem

The AddressPresenter#to_html spec builds an expected string from Faker-generated data. Faker cities can contain apostrophes (e.g. O'Connerstad), and ERB::Util.html_escape escapes ' to '. The expected string used raw characters, so the test passed or failed depending on which random city Faker returned — a classic flake.

Fix

Wrap each component in ERB::Util.html_escape when building the expected value, matching what the presenter does internally.

Verification

Ran the test with 12 different seeds (including the CI seed 32568). All pass.

@mroderick mroderick marked this pull request as ready for review June 29, 2026 15:09
@mroderick

Copy link
Copy Markdown
Collaborator Author

This is blocked by #2675

@mroderick mroderick requested a review from olleolleolle June 29, 2026 15:09
… spec

The test constructs an expected string from Faker-generated city names,
which can contain apostrophes (e.g. O'Connerstad). ERB::Util.html_escape
escapes ' to ', but the expected value used raw characters, making the
test pass or fail depending on which random city Faker returns.

Wrap each component in ERB::Util.html_escape to match the presenter's
behaviour, eliminating the flake.
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