faker 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +107 -5
  3. data/README.md +13 -2
  4. data/lib/faker/default/company.rb +13 -0
  5. data/lib/faker/default/food.rb +13 -0
  6. data/lib/faker/default/internet.rb +52 -22
  7. data/lib/faker/default/lorem.rb +18 -13
  8. data/lib/faker/default/marketing.rb +1 -1
  9. data/lib/faker/default/omniauth.rb +1 -1
  10. data/lib/faker/default/twitter.rb +1 -1
  11. data/lib/faker/default/vehicle.rb +0 -1
  12. data/lib/faker/games/dnd.rb +49 -7
  13. data/lib/faker/movies/avatar.rb +49 -0
  14. data/lib/faker/quotes/quote.rb +13 -0
  15. data/lib/faker/sports/chess.rb +90 -0
  16. data/lib/faker/travel/airport.rb +43 -0
  17. data/lib/faker/version.rb +1 -1
  18. data/lib/faker.rb +0 -1
  19. data/lib/locales/ar.yml +1 -0
  20. data/lib/locales/bg.yml +1 -1
  21. data/lib/locales/da-DK.yml +1 -0
  22. data/lib/locales/de-AT.yml +1 -1
  23. data/lib/locales/de-CH.yml +1 -0
  24. data/lib/locales/de.yml +1 -0
  25. data/lib/locales/en/airport.yml +381 -0
  26. data/lib/locales/en/avatar.yml +31 -0
  27. data/lib/locales/en/chess.yml +103 -0
  28. data/lib/locales/en/company.yml +1 -0
  29. data/lib/locales/en/dnd.yml +186 -1
  30. data/lib/locales/en/food.yml +12 -0
  31. data/lib/locales/en/internet.yml +3 -0
  32. data/lib/locales/en/mitch_hedberg.yml +46 -0
  33. data/lib/locales/en/star_wars.yml +1 -1
  34. data/lib/locales/en-AU.yml +1 -0
  35. data/lib/locales/en-CA.yml +1 -0
  36. data/lib/locales/en-GB.yml +2 -0
  37. data/lib/locales/en-MS.yml +1 -0
  38. data/lib/locales/en-NG.yml +1 -0
  39. data/lib/locales/en-NZ.yml +1 -0
  40. data/lib/locales/en-PAK.yml +1 -0
  41. data/lib/locales/en-SG.yml +1 -0
  42. data/lib/locales/en-UG.yml +1 -0
  43. data/lib/locales/en-US.yml +1 -0
  44. data/lib/locales/en-ZA.yml +1 -0
  45. data/lib/locales/en-au-ocker.yml +2 -0
  46. data/lib/locales/es-AR.yml +1 -0
  47. data/lib/locales/es-MX.yml +1 -0
  48. data/lib/locales/es.yml +2 -1
  49. data/lib/locales/fi-FI.yml +1 -0
  50. data/lib/locales/fr-CA.yml +1 -0
  51. data/lib/locales/fr-CH.yml +1 -0
  52. data/lib/locales/hy.yml +1 -0
  53. data/lib/locales/it.yml +1 -0
  54. data/lib/locales/ko.yml +1 -0
  55. data/lib/locales/mi-NZ.yml +2 -0
  56. data/lib/locales/nb-NO.yml +1 -0
  57. data/lib/locales/nl.yml +1 -0
  58. data/lib/locales/pl.yml +1 -0
  59. data/lib/locales/pt-BR.yml +1 -0
  60. data/lib/locales/pt.yml +1 -0
  61. data/lib/locales/ru.yml +1 -0
  62. data/lib/locales/sk.yml +1 -0
  63. data/lib/locales/sv.yml +1 -0
  64. data/lib/locales/tr.yml +1 -0
  65. data/lib/locales/uk.yml +2 -1
  66. data/lib/locales/vi.yml +1 -0
  67. data/lib/locales/zh-CN.yml +1 -0
  68. data/lib/locales/zh-TW.yml +1 -0
  69. metadata +25 -19
  70. data/lib/faker/default/fillmurray.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61b4ec829c7b57771a22a4efdc7488d3ffb7833ab3b3ed19c044e022b690c9e6
4
- data.tar.gz: 798f8d07f165e30b6a84fd9c27d942c79c3157fdee001dd074bb93ba91f10322
3
+ metadata.gz: 96ec3715aa40eae20241ea0235f17234c691cbd808a5a5f523e2600979bc1c18
4
+ data.tar.gz: e57effe991fbdbc74562d35066f8db66f46be5d3d441e7b650c720a072c23a94
5
5
  SHA512:
6
- metadata.gz: 47bbbd3123be42d96bae0c83db2572d696c00e32fa29712c370dce59adea5850f08d8de4116ec00c0d08381a915854d1b4343256df7c1efeee6caa2fc2dcef37
7
- data.tar.gz: e6c6d174fd957b365ba6c08b84bfa8dc4890d42c443de7b21c07de2c462246399530f5acfd722bfbc4953270c040418fb5369006796da6aa1a80d9e70561c7ad
6
+ metadata.gz: 9a12b535d55c2e3d5559228f6b9eafd98a383692165670c7a80f4a986d1c3b23637d59faa69fcc2b06142ee2445e88ce4b8057bdf72f71eafd0c86baeb9147ed
7
+ data.tar.gz: 844caa61e4c4be1975f0fc8355302627ff9ead7cf7d423dd78313a4876190482fcb471a95fb43509e0e761d0bac671484851edbaf3cf98325d7864c591b83e6e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,107 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.2.0](https://github.com/faker-ruby/faker/tree/v3.2.0) (2023-04-14)
4
+
5
+ Happy Spring with a new Faker release! 🌼
6
+
7
+ This version changes `Faker::Internet.email`, `Faker::Internet.domain_name`, `Faker::Internet.safe_email`, and `Faker::Internet.free_email` default behavior.
8
+
9
+ These generators email are now RFC 2606 compliant. They 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
+
11
+ `Faker::Internet.safe_email`, and `Faker::Internet.free_email` have been deprecated. Users have until October 2023 to make the necessary changes.
12
+
13
+ [More details and updated docs can be found here](https://github.com/faker-ruby/faker/blob/main/doc/default/internet.md#about-faker-ruby-transition-to-be-rfc-2606-compliant).
14
+
15
+ Other changes included in this version:
16
+
17
+ ## Features
18
+ * Generate safe `email` and `domain_name` by default (RFC 2606) by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2733
19
+ * Add avatar movie by @lexisvar in https://github.com/faker-ruby/faker/pull/2699
20
+ * add chess sport by @lexisvar in https://github.com/faker-ruby/faker/pull/2701
21
+ * Remove FillMurray service by @ferblape in https://github.com/faker-ruby/faker/pull/2702
22
+ * Add Allergens to Food by @AaronRustad in https://github.com/faker-ruby/faker/pull/2706
23
+ * Update sport docs by @clementf in https://github.com/faker-ruby/faker/pull/2716
24
+ * Add country code +44 to en-gb locale by @jremes-foss in https://github.com/faker-ruby/faker/pull/2731
25
+ * Add names to DnD generator by @dollerbill in https://github.com/faker-ruby/faker/pull/2735
26
+ * add digits to password by @wyattroyc in https://github.com/faker-ruby/faker/pull/2705
27
+ * performance: remove unnecessary i18n locale reload by @codez in https://github.com/faker-ruby/faker/pull/2723
28
+ * Add Faker::Company.department generator by @acuppy in https://github.com/faker-ruby/faker/pull/2737
29
+ * Mitch Hedberg quotes by @MosDeef in https://github.com/faker-ruby/faker/pull/2721
30
+
31
+ ## Bug fixes
32
+ * Fix explanation what Marketing.buzzwords does by @danieldiekmeier in https://github.com/faker-ruby/faker/pull/2700
33
+ * fix: Typo in Faker::Travel::Airport docs by @evanlouden in https://github.com/faker-ruby/faker/pull/2712
34
+ * Fix full changelog link for 3.1.1 by @rnestler in https://github.com/faker-ruby/faker/pull/2714
35
+ * Stop publishing to RubyGem by @VladVadlja in https://github.com/faker-ruby/faker/pull/2711
36
+ * Add default_country_code in locale by @ashwin-elangovan in https://github.com/faker-ruby/faker/pull/2732
37
+ * Fix formatting in readme.md by @leon-vogt in https://github.com/faker-ruby/faker/pull/2722
38
+
39
+ ## Update local dependencies
40
+ * Fix rubocop updates by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2708
41
+ * Update rubocop-minitest requirement from = 0.29.0 to = 0.30.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2743
42
+ * Update minitest requirement from = 5.17.0 to = 5.18.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2727
43
+ * Update rubocop requirement from = 1.48.1 to = 1.50.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2747
44
+ * Add Faker::Company.department generator by @acuppy in https://github.com/faker-ruby/faker/pull/2737
45
+ * Update Pull Request template and guides by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2749
46
+
47
+ ## New Contributors
48
+ * @lexisvar made their first contribution in https://github.com/faker-ruby/faker/pull/2699
49
+ * @danieldiekmeier made their first contribution in https://github.com/faker-ruby/faker/pull/2700
50
+ * @AaronRustad made their first contribution in https://github.com/faker-ruby/faker/pull/2706
51
+ * @evanlouden made their first contribution in https://github.com/faker-ruby/faker/pull/2712
52
+ * @rnestler made their first contribution in https://github.com/faker-ruby/faker/pull/2714
53
+ * @VladVadlja made their first contribution in https://github.com/faker-ruby/faker/pull/2711
54
+ * @clementf made their first contribution in https://github.com/faker-ruby/faker/pull/2716
55
+ * @leon-vogt made their first contribution in https://github.com/faker-ruby/faker/pull/2722
56
+ * @ashwin-elangovan made their first contribution in https://github.com/faker-ruby/faker/pull/2732
57
+ * @wyattroyc made their first contribution in https://github.com/faker-ruby/faker/pull/2705
58
+ * @codez made their first contribution in https://github.com/faker-ruby/faker/pull/2723
59
+ * @acuppy made their first contribution in https://github.com/faker-ruby/faker/pull/2737
60
+ * @MosDeef made their first contribution in https://github.com/faker-ruby/faker/pull/2721
61
+
62
+ **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.1.1...v3.2.0
63
+
64
+ ------------------------------------------------------------------------------
65
+
66
+ ## [v3.1.1](https://github.com/faker-ruby/faker/tree/v3.1.1) (2023-02-03)
67
+
68
+ Happy Valentine's Day with a new Faker release! 🎉
69
+
70
+ This version:
71
+
72
+ - adds and deprecates generators
73
+ - fixes bugs
74
+ - updates development dependencies
75
+
76
+ ### Features
77
+ * Add exclude_words keyword to Lorem Ipsum to prevent words from being produced by @philipfong in #2665
78
+ * Deprecate FillMurray service by @ferblape in #2657
79
+ * Airports by @ZionMiller in https://github.com/faker-ruby/faker/pull/2682
80
+
81
+ ### Bug fixes
82
+ * Fix simple typo in es.yml by @hslzr in https://github.com/faker-ruby/faker/pull/2675
83
+ * Test the Vehicle VIN validator with known good and bad values, fixes … by @alextaujenis in https://github.com/faker-ruby/faker/pull/2640
84
+ * Fix you're/your typo and inaccuracy in Star Wars quote by @dwilsonactual in https://github.com/faker-ruby/faker/pull/2693
85
+ * Revert "Typo in Ukrainian locale, fixes #2620" by @thdaraujo in https://github.com/faker-ruby/faker/pull/2690
86
+
87
+ ### Update local dependencies
88
+ * Adds Ruby 3.2 to the CI matrix. Updates checkout action version. by @petergoldstein in https://github.com/faker-ruby/faker/pull/2673
89
+ * Update rubocop-minitest requirement from = 0.25.0 to = 0.25.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2674
90
+ * Update minitest requirement from = 5.16.3 to = 5.17.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2677
91
+ * Update pry requirement from = 0.14.1 to = 0.14.2 by @dependabot in https://github.com/faker-ruby/faker/pull/2680
92
+ * Update simplecov requirement from = 0.21.2 to = 0.22.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2672
93
+ * Update rubocop requirement from = 1.44.0 to = 1.44.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2691
94
+
95
+ ### New Contributors
96
+ * @hslzr made their first contribution in https://github.com/faker-ruby/faker/pull/2675
97
+ * @ferblape made their first contribution in https://github.com/faker-ruby/faker/pull/2657
98
+ * @petergoldstein made their first contribution in https://github.com/faker-ruby/faker/pull/2673
99
+ * @dwilsonactual made their first contribution in https://github.com/faker-ruby/faker/pull/2693
100
+
101
+ **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.1.0...v3.1.1
102
+
103
+ ------------------------------------------------------------------------------
104
+
3
105
  ## [v3.1.0](https://github.com/faker-ruby/faker/tree/v3.1.0) (2022-12-23)
4
106
 
5
107
  Happy Holidays with a new Faker release! 🎉
@@ -10,13 +112,13 @@ This version:
10
112
  - fixes bugs
11
113
  - updates dependencies
12
114
 
13
- ## Features
115
+ ### Features
14
116
  * Simple Japanesemedia::CowboyBebop module by @Ivan-P23994 in https://github.com/faker-ruby/faker/pull/2617
15
117
  * added travel folder and airports by @ZionMiller in https://github.com/faker-ruby/faker/pull/2601
16
118
  * Spongebob TV show collections by @kleinjm in https://github.com/faker-ruby/faker/pull/2619
17
119
  * Add pre-push hook example by @akanshak984 in https://github.com/faker-ruby/faker/pull/2606
18
120
 
19
- ## Bug fixes
121
+ ### Bug fixes
20
122
  * fix: ensure generated passwords have correct characters when mix_case & special_characters enabled by @tiff-o in https://github.com/faker-ruby/faker/pull/2533
21
123
  * Fix: ensure sport generator produces single sport unless a number of sports is requested by @si-lens in https://github.com/faker-ruby/faker/pull/2616
22
124
  * Remove typo in ISSUE_TEMPLATE to check Faker version by @loqimean in https://github.com/faker-ruby/faker/pull/2621
@@ -24,7 +126,7 @@ This version:
24
126
  * Remove english characters in ja locale file, fixes faker-ruby#2637 by @alextaujenis in https://github.com/faker-ruby/faker/pull/2638
25
127
  * Fix country code length for non EN locale by @vbrazo in https://github.com/faker-ruby/faker/pull/2669
26
128
 
27
- ## What's Changed
129
+ ### What's Changed
28
130
  * Removed LoremPixel Files by @uzorjchibuzor in https://github.com/faker-ruby/faker/pull/2664
29
131
  * Document IBAN digits validity generator by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2625
30
132
  * Create random vehicle vin numbers with the correct check-digit by @alextaujenis in https://github.com/faker-ruby/faker/pull/2633
@@ -38,14 +140,14 @@ This version:
38
140
  * Update README and CONTRIBUTING guides by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2630
39
141
  * Update dependabot ignore list by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2629
40
142
 
41
- ## Update local dependencies
143
+ ### Update local dependencies
42
144
  * Update simplecov requirement from = 0.21.0 to = 0.21.2 by @dependabot in https://github.com/faker-ruby/faker/pull/2636
43
145
  * Update timecop requirement from = 0.9.5 to = 0.9.6 by @dependabot in https://github.com/faker-ruby/faker/pull/2642
44
146
  * Update rubocop-minitest requirement from = 0.23.2 to = 0.25.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2653
45
147
  * Update test-unit requirement from = 3.5.6 to = 3.5.7 by @dependabot in https://github.com/faker-ruby/faker/pull/2659
46
148
  * Update rubocop requirement from = 1.41.0 to = 1.41.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2667
47
149
 
48
- ## New Contributors
150
+ ### New Contributors
49
151
  * @si-lens made their first contribution in https://github.com/faker-ruby/faker/pull/2616
50
152
  * @Ivan-P23994 made their first contribution in https://github.com/faker-ruby/faker/pull/2617
51
153
  * @ZionMiller made their first contribution in https://github.com/faker-ruby/faker/pull/2601
data/README.md CHANGED
@@ -27,12 +27,16 @@ and it was the original impetus for the creation of this gem).
27
27
  ## Table of Contents
28
28
 
29
29
  - [Faker](#faker)
30
+ - [Quick links](#quick-links)
31
+ - [Table of Contents](#table-of-contents)
30
32
  - [Notes](#notes)
31
33
  - [Getting Started](#getting-started)
32
34
  - [Usage](#usage)
35
+ - [A note about the Generators versions](#a-note-about-the-generators-versions)
33
36
  - [Ensuring unique values](#ensuring-unique-values)
34
37
  - [Deterministic Random](#deterministic-random)
35
38
  - [Customization](#customization)
39
+ - [Minitest and Faker \>= 2.22](#minitest-and-faker--222)
36
40
  - [Generators](#generators)
37
41
  - [Contributing](#contributing)
38
42
  - [Versioning](#versioning)
@@ -167,7 +171,7 @@ Faker::Config.locale = :es
167
171
 
168
172
  Note: Overriding the default locale might not be thread-safe. See [Locale setting can be ignored #2563](https://github.com/faker-ruby/faker/issues/2563) for more details.
169
173
 
170
- To override Faker's locales,
174
+ To override Faker's locales,
171
175
  check out the [locales README](lib/locales/README.md).
172
176
 
173
177
  ### Minitest and Faker >= 2.22
@@ -237,7 +241,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
237
241
  - [Faker::Emotion](doc/default/emotion.md)
238
242
  - [Faker::Esport](doc/default/esport.md)
239
243
  - [Faker::File](doc/default/file.md)
240
- - [Faker::Fillmurray](doc/default/fillmurray.md)
241
244
  - [Faker::Finance](doc/default/finance.md)
242
245
  - [Faker::Food](doc/default/food.md)
243
246
  - [Faker::FunnyName](doc/default/funny_name.md)
@@ -318,6 +321,12 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
318
321
  - [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
319
322
  </details>
320
323
 
324
+ <details>
325
+ <summary>Travel</summary>
326
+
327
+ - [Faker:Travel::Airport](doc/travel/airport.md)
328
+ </details>
329
+
321
330
  <details>
322
331
  <summary>Creature</summary>
323
332
 
@@ -374,6 +383,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
374
383
  <summary>Movies</summary>
375
384
 
376
385
  - [Faker::Movie](doc/movies/movie.md)
386
+ - [Faker::Movies::Avatar](doc/movies/avatar.md)
377
387
  - [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
378
388
  - [Faker::Movies::Departed](doc/movies/departed.md)
379
389
  - [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
@@ -418,6 +428,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
418
428
 
419
429
  - [Faker::Sports](doc/sports/sports.md)
420
430
  - [Faker::Sports::Basketball](doc/sports/basketball.md)
431
+ - [Faker::Sports::Chess](doc/sports/chess.md)
421
432
  - [Faker::Sports::Football](doc/sports/football.md)
422
433
  - [Faker::Sports::Mountaineering](doc/sports/mountaineering.md)
423
434
  - [Faker::Sports::Volleyball](doc/sports/volleyball.md)
@@ -151,6 +151,19 @@ module Faker
151
151
  fetch('company.profession')
152
152
  end
153
153
 
154
+ ##
155
+ # Produces a company department.
156
+ #
157
+ # @return [String]
158
+ #
159
+ # @example
160
+ # Faker::Company.department #=> "Information Technology"
161
+ #
162
+ # @faker.version next
163
+ def department
164
+ fetch('company.department')
165
+ end
166
+
154
167
  ##
155
168
  # Produces a company spanish organisation number.
156
169
  #
@@ -5,6 +5,19 @@ module Faker
5
5
  flexible :food
6
6
 
7
7
  class << self
8
+ ##
9
+ # Retrieves an allergen.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Food.allergen #=> "Peanuts"
15
+ #
16
+ # @faker.version next
17
+ def allergen
18
+ fetch('food.allergens')
19
+ end
20
+
8
21
  ##
9
22
  # Retrieves a typical dish from each country.
10
23
  #
@@ -15,6 +15,8 @@ module Faker
15
15
  ].each(&:freeze).freeze
16
16
 
17
17
  class << self
18
+ extend Gem::Deprecate
19
+
18
20
  ##
19
21
  # Returns the email address
20
22
  #
@@ -25,10 +27,11 @@ module Faker
25
27
  # @param domain [String]
26
28
  #
27
29
  # @example
28
- # Faker::Internet.email #=> "samsmith@faker.com"
29
- # Faker::Internet.email(name: 'smith') #=> "smith@faker.com"
30
- # Faker::Internet.email(name: 'sam smith', separators: ['-']) #=> "sam-smith@faker.com"
31
- # Faker::Internet.email(name: 'sam smith', separators: ['-'], domain: 'gmail') #=> "sam-smith@gmail.com"
30
+ # Faker::Internet.email #=> "renee@zieme.test"
31
+ # Faker::Internet.email(name: 'smith') #=> "smith@bergnaum.test"
32
+ # Faker::Internet.email(name: 'sam smith', separators: ['-']) #=> "smith-sam@tromp.example"
33
+ # Faker::Internet.email(name: 'sam smith', separators: ['-'], domain: 'test') #=> "sam-smith@test.example"
34
+ # Faker::Internet.email(domain: 'gmail.com') #=> "foo@gmail.com"
32
35
  def email(name: nil, separators: nil, domain: nil)
33
36
  local_part = if separators
34
37
  username(specifier: name, separators: separators)
@@ -37,7 +40,14 @@ module Faker
37
40
  end
38
41
 
39
42
  sanitized_local_part = sanitize_email_local_part(local_part)
40
- construct_email(sanitized_local_part, domain_name(domain: domain))
43
+
44
+ generate_domain = if domain.nil?
45
+ domain_name
46
+ else
47
+ domain_name(domain: domain)
48
+ end
49
+
50
+ construct_email(sanitized_local_part, generate_domain)
41
51
  end
42
52
 
43
53
  ##
@@ -56,6 +66,7 @@ module Faker
56
66
  fetch('internet.free_email')
57
67
  )
58
68
  end
69
+ deprecate :free_email, :email, 2023, 10
59
70
 
60
71
  ##
61
72
  # Returns the email address with fixed domain name as 'example'
@@ -73,6 +84,7 @@ module Faker
73
84
  "example.#{sample(%w[org com net])}"
74
85
  )
75
86
  end
87
+ deprecate :safe_email, :email, 2023, 10
76
88
 
77
89
  ##
78
90
  # Returns the username
@@ -174,6 +186,10 @@ module Faker
174
186
  password << lower_chars[rand(lower_chars.count - 1)]
175
187
  character_bag += lower_chars
176
188
 
189
+ digits = ('1'..'9').to_a
190
+ password << digits[rand(digits.count - 1)]
191
+ character_bag += digits
192
+
177
193
  if character_types.include?(:mix_case)
178
194
  upper_chars = ('A'..'Z').to_a
179
195
  password << upper_chars[rand(upper_chars.count - 1)]
@@ -200,10 +216,12 @@ module Faker
200
216
  # @param domain [String]
201
217
  #
202
218
  # @example
203
- # Faker::Internet.domain_name #=> "test.net"
204
- # Faker::Internet.domain_name(subdomain: true) #=> "test.faker.io"
205
- # Faker::Internet.domain_name(subdomain: true, domain: 'example') #=> "faker.example.com"
206
- # Faker::Internet.domain_name(domain: 'faker') #=> "faker.org"
219
+ # Faker::Internet.domain_name #=> "altenwerth-gerhold.example"
220
+ # Faker::Internet.domain_name(subdomain: true) #=> "metz.mclaughlin-brekke.test"
221
+ # Faker::Internet.domain_name(subdomain: true, domain: 'faker') #=> "foo.faker.test"
222
+ # Faker::Internet.domain_name(domain: 'faker-ruby.org') #=> "faker-ruby.org"
223
+ # Faker::Internet.domain_name(subdomain: true, domain: 'faker-ruby.org') #=> "foo.faker-ruby.org"
224
+ # Faker::Internet.domain_name(subdomain: true, domain: 'faker.faker-ruby.org') #=> "faker.faker-ruby.org"
207
225
  def domain_name(subdomain: false, domain: nil)
208
226
  with_locale(:en) do
209
227
  if domain
@@ -211,12 +229,18 @@ module Faker
211
229
  .split('.')
212
230
  .map { |domain_part| Char.prepare(domain_part) }
213
231
  .tap do |domain_elements|
214
- domain_elements << domain_suffix if domain_elements.length < 2
215
- domain_elements.unshift(Char.prepare(domain_word)) if subdomain && domain_elements.length < 3
232
+ if domain_elements.length < 2
233
+ domain_elements << domain_suffix(safe: true)
234
+ end
235
+ if subdomain && domain_elements.length < 3
236
+ domain_elements.unshift(Char.prepare(domain_word))
237
+ end
216
238
  end.join('.')
217
239
  else
218
- [domain_word, domain_suffix].tap do |domain_elements|
219
- domain_elements.unshift(Char.prepare(domain_word)) if subdomain
240
+ [domain_word, domain_suffix(safe: true)].tap do |domain_elements|
241
+ if subdomain
242
+ domain_elements.unshift(Char.prepare(domain_word))
243
+ end
220
244
  end.join('.')
221
245
  end
222
246
  end
@@ -253,10 +277,16 @@ module Faker
253
277
  # @return [String]
254
278
  #
255
279
  # @example
256
- # Faker::Internet.domain_suffix #=> "com"
257
- # Faker::Internet.domain_suffix #=> "biz"
258
- def domain_suffix
259
- fetch('internet.domain_suffix')
280
+ # Faker::Internet.domain_suffix #=> "com"
281
+ # Faker::Internet.domain_suffix #=> "biz"
282
+ # Faker::Internet.domain_suffix(safe: true) #=> "example"
283
+ # Faker::Internet.domain_suffix(safe: true) #=> "test"
284
+ def domain_suffix(safe: nil)
285
+ if safe
286
+ fetch('internet.safe_domain_suffix')
287
+ else
288
+ fetch('internet.domain_suffix')
289
+ end
260
290
  end
261
291
 
262
292
  ##
@@ -421,10 +451,10 @@ module Faker
421
451
  # @param scheme [String]
422
452
  #
423
453
  # @example
424
- # Faker::Internet.url #=> "http://sipes-okon.com/hung.macejkovic"
454
+ # Faker::Internet.url #=> "http://treutel.test/demarcus"
425
455
  # Faker::Internet.url(host: 'faker') #=> "http://faker/shad"
426
- # Faker::Internet.url(host: 'faker', path: '/fake_test_path') #=> "http://faker/fake_test_path"
427
- # Faker::Internet.url(host: 'faker', path: '/fake_test_path', scheme: 'https') #=> "https://faker/fake_test_path"
456
+ # Faker::Internet.url(host: 'faker', path: '/docs') #=> "http://faker/docs"
457
+ # Faker::Internet.url(host: 'faker', path: '/docs', scheme: 'https') #=> "https://faker/docs"
428
458
  def url(host: domain_name, path: "/#{username}", scheme: 'http')
429
459
  "#{scheme}://#{host}#{path}"
430
460
  end
@@ -542,10 +572,10 @@ module Faker
542
572
  ##
543
573
  # Produces a randomized hash of internet user details
544
574
  # @example
545
- # Faker::Internet.user #=> { username: 'alexie', email: 'alexie@example.net' }
575
+ # Faker::Internet.user #=> { username: 'alexie', email: 'trudie@grant.test' }
546
576
  #
547
577
  # @example
548
- # Faker::Internet.user('username', 'email', 'password') #=> { username: 'alexie', email: 'alexie@example.net', password: 'DtEf9P8wS31iMyC' }
578
+ # Faker::Internet.user('username', 'email', 'password') #=> { username: 'alexie', email: 'gayle@kohler.test', password: 'DtEf9P8wS31iMyC' }
549
579
  #
550
580
  # @return [hash]
551
581
  #
@@ -28,14 +28,19 @@ module Faker
28
28
  # Faker::Lorem.words #=> ["hic", "quia", "nihil"]
29
29
  # Faker::Lorem.words(number: 4) #=> ["est", "temporibus", "et", "quaerat"]
30
30
  # Faker::Lorem.words(number: 4, supplemental: true) #=> ["nisi", "sit", "allatus", "consequatur"]
31
+ # Faker::Lorem.words(number: 4, supplemental: true, exclude_words: 'sit') #=> ["nisi", "allatus", "consequatur", "aut"]
31
32
  #
32
33
  # @faker.version 2.1.3
33
- def words(number: 3, supplemental: false)
34
+ def words(number: 3, supplemental: false, exclude_words: nil)
34
35
  resolved_num = resolve(number)
35
36
  word_list = (
36
37
  translate('faker.lorem.words') +
37
38
  (supplemental ? translate('faker.lorem.supplemental') : [])
38
39
  )
40
+ if exclude_words
41
+ exclude_words = exclude_words.split(', ') if exclude_words.instance_of?(::String)
42
+ word_list -= exclude_words
43
+ end
39
44
  word_list *= ((resolved_num / word_list.length) + 1)
40
45
  shuffle(word_list)[0, resolved_num]
41
46
  end
@@ -103,8 +108,8 @@ module Faker
103
108
  # Faker::Lorem.sentence(word_count: 5, supplemental: true, random_words_to_add:2) #=> "Crinis quo cruentus velit animi vomer."
104
109
  #
105
110
  # @faker.version 2.1.3
106
- def sentence(word_count: 4, supplemental: false, random_words_to_add: 0)
107
- words(number: word_count + rand(random_words_to_add.to_i), supplemental: supplemental).join(locale_space).capitalize + locale_period
111
+ def sentence(word_count: 4, supplemental: false, random_words_to_add: 0, exclude_words: nil)
112
+ words(number: word_count + rand(random_words_to_add.to_i), supplemental: supplemental, exclude_words: exclude_words).join(locale_space).capitalize + locale_period
108
113
  end
109
114
 
110
115
  ##
@@ -121,8 +126,8 @@ module Faker
121
126
  # Faker::Lorem.sentences(number: 2, supplemental: true) #=> ["Cito cena ad.", "Solvo animus allatus."]
122
127
  #
123
128
  # @faker.version 2.1.3
124
- def sentences(number: 3, supplemental: false)
125
- 1.upto(resolve(number)).collect { sentence(word_count: 3, supplemental: supplemental) }
129
+ def sentences(number: 3, supplemental: false, exclude_words: nil)
130
+ 1.upto(resolve(number)).collect { sentence(word_count: 3, supplemental: supplemental, exclude_words: exclude_words) }
126
131
  end
127
132
 
128
133
  ##
@@ -145,8 +150,8 @@ module Faker
145
150
  # #=> "Texo tantillus tamisium. Tribuo amissio tamisium. Facere aut canis."
146
151
  #
147
152
  # @faker.version 2.1.3
148
- def paragraph(sentence_count: 3, supplemental: false, random_sentences_to_add: 0)
149
- sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental: supplemental).join(locale_space)
153
+ def paragraph(sentence_count: 3, supplemental: false, random_sentences_to_add: 0, exclude_words: nil)
154
+ sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental: supplemental, exclude_words: exclude_words).join(locale_space)
150
155
  end
151
156
 
152
157
  ##
@@ -163,8 +168,8 @@ module Faker
163
168
  # Faker::Lorem.paragraphs(number:2, supplemental: true)
164
169
  #
165
170
  # @faker.version 2.1.3
166
- def paragraphs(number: 3, supplemental: false)
167
- 1.upto(resolve(number)).collect { paragraph(sentence_count: 3, supplemental: supplemental) }
171
+ def paragraphs(number: 3, supplemental: false, exclude_words: nil)
172
+ 1.upto(resolve(number)).collect { paragraph(sentence_count: 3, supplemental: supplemental, exclude_words: exclude_words) }
168
173
  end
169
174
 
170
175
  ##
@@ -205,8 +210,8 @@ module Faker
205
210
  # Faker::Lorem.question(word_count: 2, supplemental: true, random_words_to_add: 2) #=> "Depulso uter ut?"
206
211
  #
207
212
  # @faker.version 2.1.3
208
- def question(word_count: 4, supplemental: false, random_words_to_add: 0)
209
- words(number: word_count + rand(random_words_to_add), supplemental: supplemental).join(' ').capitalize + locale_question_mark
213
+ def question(word_count: 4, supplemental: false, random_words_to_add: 0, exclude_words: nil)
214
+ words(number: word_count + rand(random_words_to_add), supplemental: supplemental, exclude_words: exclude_words).join(' ').capitalize + locale_question_mark
210
215
  end
211
216
 
212
217
  ##
@@ -223,8 +228,8 @@ module Faker
223
228
  # Faker::Lorem.questions(number: 2, supplemental: true) #=> ["Acceptus subito cetera?", "Aro sulum cubicularis?"]
224
229
  #
225
230
  # @faker.version 2.1.3
226
- def questions(number: 3, supplemental: false)
227
- 1.upto(resolve(number)).collect { question(word_count: 3, supplemental: supplemental) }
231
+ def questions(number: 3, supplemental: false, exclude_words: nil)
232
+ 1.upto(resolve(number)).collect { question(word_count: 3, supplemental: supplemental, exclude_words: exclude_words) }
228
233
  end
229
234
 
230
235
  private
@@ -6,7 +6,7 @@ module Faker
6
6
 
7
7
  class << self
8
8
  ##
9
- # Produces the name of a video game console or platform.
9
+ # Produces a few marketing buzzwords.
10
10
  #
11
11
  # @return [String]
12
12
  #
@@ -12,7 +12,7 @@ module Faker
12
12
  super()
13
13
 
14
14
  @name = name || "#{Name.first_name} #{Name.last_name}"
15
- @email = email || Internet.safe_email(name: self.name)
15
+ @email = email || Internet.email(name: self.name)
16
16
  @first_name, @last_name = self.name.split
17
17
  end
18
18
 
@@ -63,7 +63,7 @@ module Faker
63
63
  verified: Faker::Boolean.boolean(true_ratio: 0.1)
64
64
  }
65
65
  user[:status] = Faker::Twitter.status(include_user: false) if include_status
66
- user[:email] = Faker::Internet.safe_email if include_email
66
+ user[:email] = Faker::Internet.email if include_email
67
67
  user
68
68
  end
69
69
 
@@ -9,7 +9,6 @@ module Faker
9
9
  VIN_KEYSPACE = %w[A B C D E F G H J K L M N P R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9].freeze
10
10
  VIN_TRANSLITERATION = { A: 1, B: 2, C: 3, D: 4, E: 5, F: 6, G: 7, H: 8, J: 1, K: 2, L: 3, M: 4, N: 5, P: 7, R: 9, S: 2, T: 3, U: 4, V: 5, W: 6, X: 7, Y: 8, Z: 9 }.freeze
11
11
  VIN_WEIGHT = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2].freeze
12
- VIN_REGEX = /\A[A-HJ-NPR-Z0-9]{17}\z/.freeze
13
12
  SG_CHECKSUM_WEIGHTS = [3, 14, 2, 12, 2, 11, 1].freeze
14
13
  SG_CHECKSUM_CHARS = 'AYUSPLJGDBZXTRMKHEC'
15
14
 
@@ -43,6 +43,19 @@ module Faker
43
43
  fetch('dnd.cities')
44
44
  end
45
45
 
46
+ ##
47
+ # Produces the first name of a character or monster from Dungeons and Dragons.
48
+ #
49
+ # @return [String]
50
+ #
51
+ # @example
52
+ # Faker::Games::DnD.name #=> "Eilonwy"
53
+ #
54
+ # @faker.version next
55
+ def first_name
56
+ fetch('dnd.name.first_name')
57
+ end
58
+
46
59
  ##
47
60
  # Produces the name of a class from Dungeons and Dragons (PHB).
48
61
  #
@@ -69,6 +82,19 @@ module Faker
69
82
  fetch('dnd.languages')
70
83
  end
71
84
 
85
+ ##
86
+ # Produces a last name from Dungeons and Dragons.
87
+ #
88
+ # @return [String]
89
+ #
90
+ # @example
91
+ # Faker::Games::DnD.last_name #=> "Leafwhisper"
92
+ #
93
+ # @faker.version next
94
+ def last_name
95
+ fetch('dnd.name.last_name')
96
+ end
97
+
72
98
  ##
73
99
  # Produces the name of a melee weapon from Dungeons and Dragons.
74
100
  #
@@ -95,6 +121,19 @@ module Faker
95
121
  fetch('dnd.monsters')
96
122
  end
97
123
 
124
+ ##
125
+ # Produces a full name from Dungeons and Dragons.
126
+ #
127
+ # @return [String]
128
+ #
129
+ # @example
130
+ # Faker::Games::DnD.name #=> "Drakon Blackthorn"
131
+ #
132
+ # @faker.version next
133
+ def name
134
+ "#{fetch('dnd.name.first_name')} #{fetch('dnd.name.last_name')}"
135
+ end
136
+
98
137
  ##
99
138
  # Produces the name of a race from Dungeons and Dragons (PHB).
100
139
  #
@@ -121,14 +160,17 @@ module Faker
121
160
  fetch('dnd.ranged_weapons')
122
161
  end
123
162
 
124
- # This method is deprecated. The implementation will be removed in a near future release.
125
- # Use `DnD.race` instead.
163
+ ##
164
+ # Produces a last name from Dungeons and Dragons.
126
165
  #
127
- # @deprecated Use {#race} instead.
128
- def species
129
- warn '`DnD.species` is deprecated. Use `DnD.race` instead.'
130
-
131
- super
166
+ # @return [String]
167
+ #
168
+ # @example
169
+ # Faker::Games::DnD.title_name #=> "Corvus the Cunning"
170
+ #
171
+ # @faker.version next
172
+ def title_name
173
+ "#{fetch('dnd.name.first_name')} #{fetch('dnd.name.title')}"
132
174
  end
133
175
  end
134
176
  end