Skip to content

Commit db9afa9

Browse files
committed
test: Reject duplicated punctuation
1 parent 4362c8e commit db9afa9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/faker/default/test_faker_internet.rb

+16
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ def test_email_with_apostrophes
4444
end
4545
end
4646

47+
def test_email_with_abbreviations
48+
name = 'Mr. Faker'
49+
50+
deterministically_verify -> { @tester.email(name: name) } do |email|
51+
assert_email_regex 'Mr', 'Faker', email
52+
end
53+
end
54+
55+
def test_email_against_name_generator
56+
deterministically_verify -> { @tester.email(name: Faker::Name.unique.name) } do |email|
57+
# reject emails with duplicated punctuation
58+
59+
refute_match(/[\p{Punct}]{2,}/, email)
60+
end
61+
end
62+
4763
def test_email_with_separators
4864
deterministically_verify -> { @tester.email(name: 'jane doe', separators: '+') } do |result|
4965
name, domain = result.split('@')

0 commit comments

Comments
 (0)