Skip to content

Bug Fix: test_faker_bird Unit Test Failure due to Apostrophe - #3312

Open
jremes-foss wants to merge 1 commit into
faker-ruby:mainfrom
jremes-foss:test_faker_bird_apostrophe_fix
Open

Bug Fix: test_faker_bird Unit Test Failure due to Apostrophe#3312
jremes-foss wants to merge 1 commit into
faker-ruby:mainfrom
jremes-foss:test_faker_bird_apostrophe_fix

Conversation

@jremes-foss

@jremes-foss jremes-foss commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Motivation / Background

It looks like test_faker_bird.rb fails on certain cases with Ruby 3.2, Ruby 3.3 and Ruby Head. This is due to an underlying bug in how Faker::Creature::Bird formats names and differences in random sampling and execution order across different Ruby versions.

The test fails due to apostrophe here:

O\'reilly\'s lonely barbtail

As a side effect of .capitalize, the method Faker::Creature::Bird#implausible_common_name calls .capitalize on the resulting string. In Ruby, String#capitalize forces the very first character to uppercase and all subsequent characters to lowercase which yields a regex match failure. This PR fixes the match failure by taking the apostrophe into account.

Additional information

This issue forms a blocker to subsequent pull requests and should be considered a priority. Unblocks #3307.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • Tests and Rubocop are passing before submitting your proposed changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant