diff --git a/doc/default/internet.md b/doc/default/internet.md index cb2d9fa88a..059bceb06d 100644 --- a/doc/default/internet.md +++ b/doc/default/internet.md @@ -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: 'trudie@grant.test' } @@ -25,15 +12,6 @@ Faker::Internet.email(name: 'Janelle Santiago', separators: ['+']) #=> "janelle+ Faker::Internet.email(domain: 'gmail.com') #=> "foo@gmail.com" Faker::Internet.email(name: 'sam smith', separators: ['-'], domain: 'test') #=> "sam-smith@test.test" -# Keyword arguments: name -Faker::Internet.free_email #=> "freddy@gmail.com" -Faker::Internet.free_email(name: 'Nancy') #=> "nancy@yahoo.com" - -# Generates an RFC 2606 compliant fake email, which means it will never deliver successfully -# Keyword arguments: name -Faker::Internet.safe_email #=> "christelle@example.org" -Faker::Internet.safe_email(name: 'Nancy') #=> "nancy@example.net" - # Keyword arguments: specifier, separators Faker::Internet.username #=> "alexie" Faker::Internet.username(specifier: 'Nancy') #=> "nancy" diff --git a/lib/faker/default/internet.rb b/lib/faker/default/internet.rb index af6b0bb444..b2bb65a007 100644 --- a/lib/faker/default/internet.rb +++ b/lib/faker/default/internet.rb @@ -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 #=> "samsmith@gmail.com" - # Faker::Internet.free_email(name: 'smith') #=> "smith@yahoo.com" - 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 #=> "samsmith@example.com" - # Faker::Internet.safe_email(name: 'smith') #=> "smith@example.net" - 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 # diff --git a/lib/locales/bg.yml b/lib/locales/bg.yml index 5cf6b0867f..4220cfc009 100644 --- a/lib/locales/bg.yml +++ b/lib/locales/bg.yml @@ -17,7 +17,6 @@ bg: default_country: [България] default_country_code: ["BG"] internet: - free_email: [abv.bg, mail.bg, dir.bg, gmail.com, yahoo.com, hotmail.com] domain_suffix: [com, bg, info, бг, net, org] name: diff --git a/lib/locales/de-AT.yml b/lib/locales/de-AT.yml index ecdfccf54a..1eb6fab63f 100644 --- a/lib/locales/de-AT.yml +++ b/lib/locales/de-AT.yml @@ -622,10 +622,6 @@ de-AT: - "#{Name.last_name}-#{Name.last_name}" - "#{Name.last_name}, #{Name.last_name} und #{Name.last_name}" internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com domain_suffix: - com - info diff --git a/lib/locales/de-CH.yml b/lib/locales/de-CH.yml index e33cbdac95..7d197185ba 100644 --- a/lib/locales/de-CH.yml +++ b/lib/locales/de-CH.yml @@ -3505,14 +3505,6 @@ de-CH: - "#{half_wind_azimuth}" - "#{quarter_wind_azimuth}" internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com - - gmx.de - - web.de - - mail.de - - freenet.de domain_suffix: - ch - com diff --git a/lib/locales/de.yml b/lib/locales/de.yml index fde6622e83..ce4fa39b0b 100644 --- a/lib/locales/de.yml +++ b/lib/locales/de.yml @@ -1510,14 +1510,6 @@ de: - "#{half_wind_azimuth}" - "#{quarter_wind_azimuth}" internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com - - gmx.de - - web.de - - mail.de - - freenet.de domain_suffix: - com - info diff --git a/lib/locales/ee.yml b/lib/locales/ee.yml index 9038953c45..e0c65a9b9e 100644 --- a/lib/locales/ee.yml +++ b/lib/locales/ee.yml @@ -36,7 +36,6 @@ ee: - "#{suffix} #{Name.last_name}" internet: - free_email: [gmail.com, yahoo.com, hotmail.com] domain_suffix: [com, com.ee, ee, net, org] name: diff --git a/lib/locales/en-CA.yml b/lib/locales/en-CA.yml index 35d419e103..58c7bf03b2 100644 --- a/lib/locales/en-CA.yml +++ b/lib/locales/en-CA.yml @@ -35,10 +35,6 @@ en-CA: default_country_code: - CA internet: - free_email: - - gmail.com - - yahoo.ca - - hotmail.com domain_suffix: - ca - com diff --git a/lib/locales/en-IND.yml b/lib/locales/en-IND.yml index d1cfb331f2..4b3b39a57c 100644 --- a/lib/locales/en-IND.yml +++ b/lib/locales/en-IND.yml @@ -1241,10 +1241,6 @@ en-IND: default_country_code: - IN internet: - free_email: - - gmail.com - - yahoo.co.in - - hotmail.com domain_suffix: - in - com diff --git a/lib/locales/en-NEP.yml b/lib/locales/en-NEP.yml index eaf0cbe9a5..0965677144 100644 --- a/lib/locales/en-NEP.yml +++ b/lib/locales/en-NEP.yml @@ -205,11 +205,6 @@ en-NEP: default_country: - Nepal internet: - free_email: - - worldlink.com.np - - gmail.com - - yahoo.com - - hotmail.com domain_suffix: - np - com diff --git a/lib/locales/en-PAK.yml b/lib/locales/en-PAK.yml index 002fea4ae1..037ea29f27 100644 --- a/lib/locales/en-PAK.yml +++ b/lib/locales/en-PAK.yml @@ -350,10 +350,6 @@ en-PAK: default_country_code: - PK internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com domain_suffix: - pk - com diff --git a/lib/locales/en/internet.yml b/lib/locales/en/internet.yml index a2bdd23cf9..720d983998 100644 --- a/lib/locales/en/internet.yml +++ b/lib/locales/en/internet.yml @@ -13,10 +13,6 @@ en: safe_domain_suffix: - example - test - free_email: - - gmail.com - - yahoo.com - - hotmail.com slug: - report - appointment diff --git a/lib/locales/es-MX.yml b/lib/locales/es-MX.yml index ffbbf9c721..d327f5413d 100644 --- a/lib/locales/es-MX.yml +++ b/lib/locales/es-MX.yml @@ -47,7 +47,6 @@ es-MX: - "#{University.prefix} #{Address.state} #{University.suffix}" internet: - free_email: [gmail.com, yahoo.com, hotmail.com, prodigy.net.mx] domain_suffix: [com, com.mx, mx, info, me, org, org.mx] name: diff --git a/lib/locales/es.yml b/lib/locales/es.yml index 1cf686ade4..c218c1e541 100644 --- a/lib/locales/es.yml +++ b/lib/locales/es.yml @@ -50,7 +50,6 @@ es: internet: - free_email: [gmail.com, yahoo.com, hotmail.com] domain_suffix: [com, es, info, com.es, org] name: diff --git a/lib/locales/fr-CA.yml b/lib/locales/fr-CA.yml index cfcc131aee..a9e43d9de4 100644 --- a/lib/locales/fr-CA.yml +++ b/lib/locales/fr-CA.yml @@ -120,10 +120,6 @@ fr-CA: default_country_code: - CA internet: - free_email: - - gmail.com - - yahoo.ca - - hotmail.com domain_suffix: - ca - com diff --git a/lib/locales/fr-CH.yml b/lib/locales/fr-CH.yml index a35e60a00f..e62795dd2d 100644 --- a/lib/locales/fr-CH.yml +++ b/lib/locales/fr-CH.yml @@ -35,7 +35,6 @@ fr-CH: - ["synergies", "web-readiness", "paradigms", "markets", "partnerships", "infrastructures", "platforms", "initiatives", "channels", "eyeballs", "communities", "ROI", "solutions", "e-tailers", "e-services", "action-items", "portals", "niches", "technologies", "content", "vortals", "supply-chains", "convergence", "relationships", "architectures", "interfaces", "e-markets", "e-commerce", "systems", "bandwidth", "infomediaries", "models", "mindshare", "deliverables", "users", "schemas", "networks", "applications", "metrics", "e-business", "functionalities", "experiences", "web services", "methodologies"] internet: - free_email: [gmail.com, yahoo.ch, hotmail.ch] domain_suffix: [com, net, biz, ch, li, at, ch, ch] lorem: diff --git a/lib/locales/fr/internet.yml b/lib/locales/fr/internet.yml index 094f0448fe..029393861e 100644 --- a/lib/locales/fr/internet.yml +++ b/lib/locales/fr/internet.yml @@ -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] diff --git a/lib/locales/hy.yml b/lib/locales/hy.yml index 5696020b3c..e4a670e8b7 100644 --- a/lib/locales/hy.yml +++ b/lib/locales/hy.yml @@ -2290,14 +2290,6 @@ hy: - սանտիլիտր - լիտր internet: - free_email: - - freenet.am - - namag.net - - yandex.ru - - mail.ru - - gmail.com - - yahoo.com - - hotmail.com domain_suffix: - am - com diff --git a/lib/locales/it.yml b/lib/locales/it.yml index de6aecdd9d..e0d9014b85 100644 --- a/lib/locales/it.yml +++ b/lib/locales/it.yml @@ -845,13 +845,6 @@ it: - "#{Name.last_name}-#{Name.last_name} #{suffix}" - "#{Name.last_name}, #{Name.last_name} e #{Name.last_name} #{suffix}" internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com - - email.it - - libero.it - - yahoo.it domain_suffix: - com - com diff --git a/lib/locales/ko.yml b/lib/locales/ko.yml index 51b8bfa503..aab0274e43 100644 --- a/lib/locales/ko.yml +++ b/lib/locales/ko.yml @@ -111,7 +111,6 @@ ko: binary_types: ['여성', '남성'] internet: - free_email: [gmail.com, yahoo.co.kr, hanmail.net, naver.com] domain_suffix: [co.kr, com, biz, info, ne.kr, net, or.kr, org] lorem: diff --git a/lib/locales/lt.yml b/lib/locales/lt.yml index fdd05c9db9..6b077b9a9c 100644 --- a/lib/locales/lt.yml +++ b/lib/locales/lt.yml @@ -158,10 +158,6 @@ lt: - VŠĮ - MB internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com domain_suffix: - lt - com diff --git a/lib/locales/lv.yml b/lib/locales/lv.yml index 7d7ebbc214..ff0288bf03 100644 --- a/lib/locales/lv.yml +++ b/lib/locales/lv.yml @@ -30,7 +30,6 @@ lv: - "#{suffix} #{Name.last_name}" internet: - free_email: [gmail.com, yahoo.com, hotmail.com] domain_suffix: [com, lv, net, org] name: diff --git a/lib/locales/nl.yml b/lib/locales/nl.yml index 5343d987a7..f2465d8f53 100644 --- a/lib/locales/nl.yml +++ b/lib/locales/nl.yml @@ -53,7 +53,6 @@ nl: suffix: [BV, V.O.F., Group, en Zonen] internet: - free_email: [gmail.com, yahoo.com, hotmail.nl, live.nl, outlook.com, kpnmail.nl] domain_suffix: [nl, com, net, org] lorem: diff --git a/lib/locales/pl.yml b/lib/locales/pl.yml index 1a108b7928..e981e06e8f 100644 --- a/lib/locales/pl.yml +++ b/lib/locales/pl.yml @@ -42,7 +42,6 @@ pl: - "#{Name.last_name}, #{Name.last_name} and #{Name.last_name}" internet: - free_email: [gmail.com, yahoo.com, hotmail.com, wp.pl, onet.pl, interia.pl] domain_suffix: [com, pl, com.pl, net, org] lorem: diff --git a/lib/locales/pt-BR.yml b/lib/locales/pt-BR.yml index b15a86a46f..b27b16d45d 100644 --- a/lib/locales/pt-BR.yml +++ b/lib/locales/pt-BR.yml @@ -5737,12 +5737,6 @@ pt-BR: - "#{University.prefix} #{Name.last_name} #{University.suffix}" - "#{University.prefix} #{Name.last_name}" internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com - - live.com - - bol.com.br domain_suffix: - br - com diff --git a/lib/locales/pt.yml b/lib/locales/pt.yml index 73c12d3ac8..2f0547f0d5 100644 --- a/lib/locales/pt.yml +++ b/lib/locales/pt.yml @@ -459,12 +459,6 @@ pt: - "#{Name.last_name}-#{Name.last_name}" - "#{Name.last_name}, #{Name.last_name} e #{Name.last_name}" internet: - free_email: - - gmail.com - - yahoo.com - - hotmail.com - - live.com - - bol.com.br domain_suffix: - pt - com diff --git a/lib/locales/ru.yml b/lib/locales/ru.yml index 44a5431544..4cbb7136bb 100644 --- a/lib/locales/ru.yml +++ b/lib/locales/ru.yml @@ -478,13 +478,6 @@ ru: - "#{postcode} #{default_country}, #{city}, #{street_address}" - "#{postcode} #{default_country}, #{city}, #{street_address} #{secondary_address}" internet: - free_email: - - yandex.ru - - ya.ru - - mail.ru - - gmail.com - - yahoo.com - - hotmail.com domain_suffix: - com - ru diff --git a/lib/locales/sk.yml b/lib/locales/sk.yml index d871e26d28..b6146c0b26 100644 --- a/lib/locales/sk.yml +++ b/lib/locales/sk.yml @@ -2322,10 +2322,6 @@ sk: - "#{Name.last_name} #{suffix}" - "#{Name.man_last_name} a #{Name.man_last_name} #{suffix}" internet: - free_email: - - gmail.com - - zoznam.sk - - azet.sk domain_suffix: - sk - com diff --git a/lib/locales/tr.yml b/lib/locales/tr.yml index 55c0080dae..e1ff5c680d 100644 --- a/lib/locales/tr.yml +++ b/lib/locales/tr.yml @@ -19,9 +19,7 @@ tr: - "#{first_name} #{last_name} #{last_name}" internet: - free_email: [gmail.com, hotmail.com.tr, yandex.com.tr] domain_suffix: [co, com, com.tr, net, org] - safe_email: ['mesela.com'] phone_number: formats: ["90-###-###-####", "90.###.###.####", "90 ### ### ####", "90##########"] diff --git a/lib/locales/uk.yml b/lib/locales/uk.yml index c49ef5afca..fabfd2a19c 100644 --- a/lib/locales/uk.yml +++ b/lib/locales/uk.yml @@ -355,14 +355,6 @@ uk: default_country_code: - UA internet: - free_email: - - ukr.net - - ex.ua - - e-mail.ua - - i.ua - - meta.ua - - yandex.ua - - gmail.com domain_suffix: - cherkassy.ua - cherkasy.ua diff --git a/test/faker/default/test_faker_internet.rb b/test/faker/default/test_faker_internet.rb index 76a50642bf..4dc7cf3aad 100644 --- a/test/faker/default/test_faker_internet.rb +++ b/test/faker/default/test_faker_internet.rb @@ -78,30 +78,6 @@ def test_email_with_name_seperators_domain end end - def test_free_email - Gem::Deprecate.skip_during do - assert_match(/.+@(gmail|hotmail|yahoo)\.com/, @tester.free_email) - end - end - - def test_free_email_with_non_permitted_characters - Gem::Deprecate.skip_during do - assert_match(/mart#n@.+\.\w+/, @tester.free_email(name: 'martín')) - end - end - - def test_safe_email - Gem::Deprecate.skip_during do - assert_match(/.+@example.(com|net|org)/, @tester.safe_email) - end - end - - def test_safe_email_with_non_permitted_characters - Gem::Deprecate.skip_during do - assert_match(/mart#n@.+\.\w+/, @tester.safe_email(name: 'martín')) - end - end - def test_username assert_match(/[a-z]+((_|\.)[a-z]+)?/, @tester.username(specifier: 0..3)) assert_match(/[a-z]+((_|\.)[a-z]+)?/, @tester.username)