Skip to content

Commit 505a667

Browse files
authored
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
1 parent e4ab99f commit 505a667

31 files changed

+0
-191
lines changed

doc/default/internet.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
# Faker::Internet
22

3-
### About faker-ruby transition to be RFC 2606 compliant
4-
5-
faker-ruby is transitioning to no longer generating real email and url addresses.
6-
7-
The migration plan is:
8-
- First step:
9-
- 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.
10-
- add deprecation message for `free_email` and `safe_email` users to switch to `email` instead.
11-
- Second step (after October 2023):
12-
- remove deprecated generators and locales.
13-
14-
To give users time, once the first step is released, users will have until October 2023 to make the necessary changes.
15-
163
```ruby
174
# Keyword arguments: name, username, email, password, domain_name, user_agent, uuid etc...
185
Faker::Internet.user #=> { username: 'alexie', email: '[email protected]' }
@@ -25,15 +12,6 @@ Faker::Internet.email(name: 'Janelle Santiago', separators: ['+']) #=> "janelle+
2512
Faker::Internet.email(domain: 'gmail.com') #=> "[email protected]"
2613
Faker::Internet.email(name: 'sam smith', separators: ['-'], domain: 'test') #=> "[email protected]"
2714

28-
# Keyword arguments: name
29-
Faker::Internet.free_email #=> "[email protected]"
30-
Faker::Internet.free_email(name: 'Nancy') #=> "[email protected]"
31-
32-
# Generates an RFC 2606 compliant fake email, which means it will never deliver successfully
33-
# Keyword arguments: name
34-
Faker::Internet.safe_email #=> "[email protected]"
35-
Faker::Internet.safe_email(name: 'Nancy') #=> "[email protected]"
36-
3715
# Keyword arguments: specifier, separators
3816
Faker::Internet.username #=> "alexie"
3917
Faker::Internet.username(specifier: 'Nancy') #=> "nancy"

lib/faker/default/internet.rb

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ class Internet < Base
1515
].each(&:freeze).freeze
1616

1717
class << self
18-
extend Gem::Deprecate
19-
2018
##
2119
# Returns the email address
2220
#
@@ -50,42 +48,6 @@ def email(name: nil, separators: nil, domain: nil)
5048
construct_email(sanitized_local_part, generate_domain)
5149
end
5250

53-
##
54-
# Returns the email address with domain either gmail.com, yahoo.com or hotmail.com
55-
#
56-
# @return [String]
57-
#
58-
# @param name [String]
59-
#
60-
# @example
61-
# Faker::Internet.free_email #=> "[email protected]"
62-
# Faker::Internet.free_email(name: 'smith') #=> "[email protected]"
63-
def free_email(name: nil)
64-
construct_email(
65-
sanitize_email_local_part(username(specifier: name)),
66-
fetch('internet.free_email')
67-
)
68-
end
69-
deprecate :free_email, :email, 2023, 10
70-
71-
##
72-
# Returns the email address with fixed domain name as 'example'
73-
#
74-
# @return [String]
75-
#
76-
# @param name [String]
77-
#
78-
# @example
79-
# Faker::Internet.safe_email #=> "[email protected]"
80-
# Faker::Internet.safe_email(name: 'smith') #=> "[email protected]"
81-
def safe_email(name: nil)
82-
construct_email(
83-
sanitize_email_local_part(username(specifier: name)),
84-
"example.#{sample(%w[org com net])}"
85-
)
86-
end
87-
deprecate :safe_email, :email, 2023, 10
88-
8951
##
9052
# Returns the username
9153
#

lib/locales/bg.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ bg:
1717
default_country: [България]
1818
default_country_code: ["BG"]
1919
internet:
20-
free_email: [abv.bg, mail.bg, dir.bg, gmail.com, yahoo.com, hotmail.com]
2120
domain_suffix: [com, bg, info, бг, net, org]
2221

2322
name:

lib/locales/de-AT.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,6 @@ de-AT:
622622
- "#{Name.last_name}-#{Name.last_name}"
623623
- "#{Name.last_name}, #{Name.last_name} und #{Name.last_name}"
624624
internet:
625-
free_email:
626-
- gmail.com
627-
- yahoo.com
628-
- hotmail.com
629625
domain_suffix:
630626
- com
631627
- info

lib/locales/de-CH.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,14 +3505,6 @@ de-CH:
35053505
- "#{half_wind_azimuth}"
35063506
- "#{quarter_wind_azimuth}"
35073507
internet:
3508-
free_email:
3509-
- gmail.com
3510-
- yahoo.com
3511-
- hotmail.com
3512-
- gmx.de
3513-
- web.de
3514-
- mail.de
3515-
- freenet.de
35163508
domain_suffix:
35173509
- ch
35183510
- com

lib/locales/de.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,14 +1510,6 @@ de:
15101510
- "#{half_wind_azimuth}"
15111511
- "#{quarter_wind_azimuth}"
15121512
internet:
1513-
free_email:
1514-
- gmail.com
1515-
- yahoo.com
1516-
- hotmail.com
1517-
- gmx.de
1518-
- web.de
1519-
- mail.de
1520-
- freenet.de
15211513
domain_suffix:
15221514
- com
15231515
- info

lib/locales/ee.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ ee:
3636
- "#{suffix} #{Name.last_name}"
3737

3838
internet:
39-
free_email: [gmail.com, yahoo.com, hotmail.com]
4039
domain_suffix: [com, com.ee, ee, net, org]
4140

4241
name:

lib/locales/en-CA.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ en-CA:
3535
default_country_code:
3636
- CA
3737
internet:
38-
free_email:
39-
- gmail.com
40-
- yahoo.ca
41-
- hotmail.com
4238
domain_suffix:
4339
- ca
4440
- com

lib/locales/en-IND.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,10 +1241,6 @@ en-IND:
12411241
default_country_code:
12421242
- IN
12431243
internet:
1244-
free_email:
1245-
- gmail.com
1246-
- yahoo.co.in
1247-
- hotmail.com
12481244
domain_suffix:
12491245
- in
12501246
- com

lib/locales/en-NEP.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ en-NEP:
205205
default_country:
206206
- Nepal
207207
internet:
208-
free_email:
209-
- worldlink.com.np
210-
- gmail.com
211-
- yahoo.com
212-
- hotmail.com
213208
domain_suffix:
214209
- np
215210
- com

0 commit comments

Comments
 (0)