-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
Faker::Internet.username
should not generate duplicated punctu…
…ation (#2970) * `Faker::Internet.username` should not generate duplicated punctuation * test: Reject duplicated punctuation
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,22 @@ def test_email_with_apostrophes | |
end | ||
end | ||
|
||
def test_email_with_abbreviations | ||
name = 'Mr. Faker' | ||
|
||
deterministically_verify -> { @tester.email(name: name) } do |email| | ||
assert_email_regex 'Mr', 'Faker', email | ||
end | ||
end | ||
|
||
def test_email_against_name_generator | ||
deterministically_verify -> { @tester.email(name: Faker::Name.unique.name) } do |email| | ||
# reject emails with duplicated punctuation | ||
# e.g.: "[email protected]" | ||
refute_match(/[\p{Punct}]{2,}/, email) | ||
end | ||
end | ||
|
||
def test_email_with_separators | ||
deterministically_verify -> { @tester.email(name: 'jane doe', separators: '+') } do |result| | ||
name, domain = result.split('@') | ||
|