Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Username splits names by space and doesn't regex match them #2950

Merged
merged 9 commits into from
May 28, 2024

Conversation

keshavbiswa
Copy link
Contributor

Motivation / Background

This Pull Request has been created because Username doesn't behave well with Apostrophe names such as "Alexis O'Connell".

Since we're matching them by word, it breaks them into 3 parts "alexis", "o", "connell". (Not sure if this is correct behaviour as we don't have English names 😅 )
This causes problem testing emails as we get the following list of permutations:

alexis.o.connell@domain.example
alexis.connell.o@domain.example
connell.alexis.o@domain.example
connell.o.alexis@domain.example
o.connell.alexis@domain.example
o.alexis.connell@domain.example
alexis_o_connell@domain.example
alexis_connell_o@domain.example
connell_alexis_o@domain.example
connell_o_alexis@domain.example
o_connell_alexis@domain.example
o_alexis_connell@domain.example

This PR breaks names by Spaces and doesn't ignore '.

Additional information

This PR also fixes: #2943

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.

If you're proposing a new generator or locale:

  • Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.
  • You've reviewed and followed the Contributing guidelines.

@stefannibrasil
Copy link
Contributor

hi @keshavbiswa thanks! I think we want to drop the character and make it part of the last name. I added a comment here #2943 (comment)

lib/faker/default/internet.rb Outdated Show resolved Hide resolved
test/faker/default/test_faker_internet.rb Outdated Show resolved Hide resolved
@keshavbiswa
Copy link
Contributor Author

So ultimately, I am stripping username with apostrophe '. Please re-review 🙃 @stefannibrasil @alextaujenis

Copy link
Contributor

@alextaujenis alextaujenis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point all I see are the two outstanding issues with the regular expressions, everything else looks good. Also, nice job identifying the Faker::String issue!

test/faker/default/test_faker_internet.rb Outdated Show resolved Hide resolved
test/support/assert_email_regex.rb Outdated Show resolved Hide resolved
@keshavbiswa
Copy link
Contributor Author

Could I get a re-review on this 🙂 ? @alextaujenis @stefannibrasil

@keshavbiswa
Copy link
Contributor Author

@stefannibrasil Can we merge this?

Copy link
Contributor

@stefannibrasil stefannibrasil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @keshavbiswa looking much better now without splitting the apostrophe from the last name 🎉

@stefannibrasil stefannibrasil merged commit 5117816 into faker-ruby:main May 28, 2024
8 checks passed
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.

Random Test Failure: Faker::Omniauth tests fail when generating a name with an apostrophe
3 participants