-
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.
Remove deprecate safe_email and free_email methods (#2841)
* refactor: 💡 remove safe_email, free_email * test: 💍 remove safe_email, free_email test * refactor: 💡 remove safe_email, free_email from lib/locales/ * refactor: 💡 remove safe_email, free_email from internet.md * refactor: 💡 remove extend Gem::Deprecate * refactor: 💡 rubocop -a --only Layout/EmptyLinesAroundClassBody
- Loading branch information
Showing
31 changed files
with
0 additions
and
191 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
# Faker::Internet | ||
|
||
### About faker-ruby transition to be RFC 2606 compliant | ||
|
||
faker-ruby is transitioning to no longer generating real email and url addresses. | ||
|
||
The migration plan is: | ||
- First step: | ||
- change `email` and `domain_name` to be RFC 2606 compliant. Both now generate safe values by default using the Reserved Top Level DNS Names: `example` and `test`. To maintain backwards compatibility and give users the option to use non-safe domains at their own risk, custom domains are allowed. | ||
- add deprecation message for `free_email` and `safe_email` users to switch to `email` instead. | ||
- Second step (after October 2023): | ||
- remove deprecated generators and locales. | ||
|
||
To give users time, once the first step is released, users will have until October 2023 to make the necessary changes. | ||
|
||
```ruby | ||
# Keyword arguments: name, username, email, password, domain_name, user_agent, uuid etc... | ||
Faker::Internet.user #=> { username: 'alexie', email: '[email protected]' } | ||
|
@@ -25,15 +12,6 @@ Faker::Internet.email(name: 'Janelle Santiago', separators: ['+']) #=> "janelle+ | |
Faker::Internet.email(domain: 'gmail.com') #=> "[email protected]" | ||
Faker::Internet.email(name: 'sam smith', separators: ['-'], domain: 'test') #=> "[email protected]" | ||
|
||
# Keyword arguments: name | ||
Faker::Internet.free_email #=> "[email protected]" | ||
Faker::Internet.free_email(name: 'Nancy') #=> "[email protected]" | ||
|
||
# Generates an RFC 2606 compliant fake email, which means it will never deliver successfully | ||
# Keyword arguments: name | ||
Faker::Internet.safe_email #=> "[email protected]" | ||
Faker::Internet.safe_email(name: 'Nancy') #=> "[email protected]" | ||
|
||
# Keyword arguments: specifier, separators | ||
Faker::Internet.username #=> "alexie" | ||
Faker::Internet.username(specifier: 'Nancy') #=> "nancy" | ||
|
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 |
---|---|---|
|
@@ -15,8 +15,6 @@ class Internet < Base | |
].each(&:freeze).freeze | ||
|
||
class << self | ||
extend Gem::Deprecate | ||
|
||
## | ||
# Returns the email address | ||
# | ||
|
@@ -50,42 +48,6 @@ def email(name: nil, separators: nil, domain: nil) | |
construct_email(sanitized_local_part, generate_domain) | ||
end | ||
|
||
## | ||
# Returns the email address with domain either gmail.com, yahoo.com or hotmail.com | ||
# | ||
# @return [String] | ||
# | ||
# @param name [String] | ||
# | ||
# @example | ||
# Faker::Internet.free_email #=> "[email protected]" | ||
# Faker::Internet.free_email(name: 'smith') #=> "[email protected]" | ||
def free_email(name: nil) | ||
construct_email( | ||
sanitize_email_local_part(username(specifier: name)), | ||
fetch('internet.free_email') | ||
) | ||
end | ||
deprecate :free_email, :email, 2023, 10 | ||
|
||
## | ||
# Returns the email address with fixed domain name as 'example' | ||
# | ||
# @return [String] | ||
# | ||
# @param name [String] | ||
# | ||
# @example | ||
# Faker::Internet.safe_email #=> "[email protected]" | ||
# Faker::Internet.safe_email(name: 'smith') #=> "[email protected]" | ||
def safe_email(name: nil) | ||
construct_email( | ||
sanitize_email_local_part(username(specifier: name)), | ||
"example.#{sample(%w[org com net])}" | ||
) | ||
end | ||
deprecate :safe_email, :email, 2023, 10 | ||
|
||
## | ||
# Returns the username | ||
# | ||
|
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
fr: | ||
faker: | ||
internet: | ||
free_email: [gmail.com, yahoo.fr, hotmail.fr] | ||
domain_suffix: [com, fr, eu, info, name, net, org, immo, paris, alsace, bzh] |
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
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
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
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
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
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
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
Oops, something went wrong.