ffaker 2.21.0 → 2.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +131 -17
  3. data/Gemfile +15 -0
  4. data/README.md +18 -6
  5. data/REFERENCE.md +1012 -969
  6. data/Rakefile +16 -47
  7. data/bin/console +9 -0
  8. data/ffaker.gemspec +9 -23
  9. data/lib/ffaker/address.rb +4 -4
  10. data/lib/ffaker/address_fr.rb +3 -5
  11. data/lib/ffaker/address_it.rb +1 -4
  12. data/lib/ffaker/address_ua.rb +1 -1
  13. data/lib/ffaker/avatar.rb +11 -3
  14. data/lib/ffaker/bank.rb +1 -1
  15. data/lib/ffaker/bank_us.rb +33 -0
  16. data/lib/ffaker/book.rb +15 -7
  17. data/lib/ffaker/cheesy_lingo.rb +2 -2
  18. data/lib/ffaker/code.rb +1 -1
  19. data/lib/ffaker/company.rb +2 -2
  20. data/lib/ffaker/company_fr.rb +2 -2
  21. data/lib/ffaker/crypto.rb +14 -0
  22. data/lib/ffaker/data/address_de/state +1 -0
  23. data/lib/ffaker/data/jo_jo/first_names +356 -0
  24. data/lib/ffaker/data/jo_jo/full_names +225 -0
  25. data/lib/ffaker/data/jo_jo/last_names +153 -0
  26. data/lib/ffaker/data/jo_jo/stands +149 -0
  27. data/lib/ffaker/date.rb +40 -0
  28. data/lib/ffaker/filesystem.rb +12 -2
  29. data/lib/ffaker/geolocation.rb +2 -2
  30. data/lib/ffaker/identification_br.rb +3 -12
  31. data/lib/ffaker/identification_ec.rb +39 -0
  32. data/lib/ffaker/identification_es_cl.rb +2 -2
  33. data/lib/ffaker/identification_es_co.rb +1 -1
  34. data/lib/ffaker/identification_kr.rb +11 -4
  35. data/lib/ffaker/identification_pl.rb +6 -6
  36. data/lib/ffaker/identification_tw.rb +1 -1
  37. data/lib/ffaker/image.rb +28 -4
  38. data/lib/ffaker/jo_jo.rb +24 -0
  39. data/lib/ffaker/lorem_ja.rb +1 -1
  40. data/lib/ffaker/lorem_ru.rb +1 -1
  41. data/lib/ffaker/movie.rb +1 -1
  42. data/lib/ffaker/name_fr.rb +4 -3
  43. data/lib/ffaker/name_pl.rb +1 -1
  44. data/lib/ffaker/number.rb +6 -2
  45. data/lib/ffaker/phone_number_de.rb +3 -3
  46. data/lib/ffaker/skill.rb +1 -1
  47. data/lib/ffaker/ssn.rb +4 -2
  48. data/lib/ffaker/ssn_se.rb +2 -2
  49. data/lib/ffaker/string.rb +1 -1
  50. data/lib/ffaker/time.rb +3 -3
  51. data/lib/ffaker/utils/module_utils.rb +5 -6
  52. data/lib/ffaker/utils/unique_utils.rb +33 -21
  53. data/lib/ffaker/vehicle.rb +2 -2
  54. data/lib/{version.rb → ffaker/version.rb} +1 -1
  55. data/lib/ffaker.rb +63 -191
  56. data/scripts/reference.rb +8 -10
  57. data/test/helper.rb +3 -5
  58. data/test/test_address_da.rb +3 -3
  59. data/test/test_address_fi.rb +2 -2
  60. data/test/test_address_se.rb +2 -2
  61. data/test/test_avatar.rb +30 -7
  62. data/test/test_bank_us.rb +35 -0
  63. data/test/test_book.rb +29 -0
  64. data/test/test_cheesy_lingo.rb +1 -1
  65. data/test/test_color.rb +3 -3
  66. data/test/test_crypto.rb +15 -0
  67. data/test/test_date.rb +47 -0
  68. data/test/test_filesystem.rb +30 -4
  69. data/test/test_freedom_ipsum.rb +1 -1
  70. data/test/test_gender_it.rb +1 -1
  71. data/test/test_gender_ja.rb +1 -1
  72. data/test/test_gender_jp.rb +1 -1
  73. data/test/test_gender_pl.rb +1 -1
  74. data/test/test_healthcare_ru.rb +1 -1
  75. data/test/test_hipster_ipsum.rb +1 -1
  76. data/test/test_html_ipsum.rb +2 -2
  77. data/test/test_identification.rb +12 -2
  78. data/test/test_identification_ec.rb +33 -0
  79. data/test/test_identification_es_mx.rb +3 -1
  80. data/test/test_identification_it.rb +12 -1
  81. data/test/test_identification_kr.rb +3 -3
  82. data/test/test_image.rb +51 -5
  83. data/test/test_internet.rb +3 -1
  84. data/test/test_internet_se.rb +5 -2
  85. data/test/test_jo_jo.rb +29 -0
  86. data/test/test_lorem_br.rb +2 -2
  87. data/test/test_lorem_cn.rb +3 -3
  88. data/test/test_lorem_fr.rb +3 -3
  89. data/test/test_lorem_ie.rb +2 -2
  90. data/test/test_lorem_kr.rb +3 -3
  91. data/test/test_lorem_pl.rb +2 -2
  92. data/test/test_lorem_ru.rb +3 -3
  93. data/test/test_lorem_ua.rb +3 -3
  94. data/test/test_module_utils.rb +33 -0
  95. data/test/test_name_da.rb +1 -1
  96. data/test/test_name_ph.rb +1 -1
  97. data/test/test_name_ru.rb +2 -2
  98. data/test/test_name_ua.rb +2 -2
  99. data/test/test_number.rb +13 -1
  100. data/test/test_phone_number_nl.rb +1 -1
  101. data/test/test_phone_number_se.rb +1 -1
  102. data/test/test_phone_number_sg.rb +8 -8
  103. data/test/test_unique_utils.rb +29 -5
  104. data/test/test_units.rb +6 -6
  105. data/test/test_units_english.rb +15 -15
  106. data/test/test_units_metric.rb +15 -15
  107. data/test/test_vehicle.rb +22 -0
  108. metadata +24 -241
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c192ca9da2eae4b0b7cde440c26750a269de60ff3b07dcd5c73ef3fcc11afb1b
4
- data.tar.gz: a8ff030a5c7141b36fdc15c1842a13b1fca40b07f5c2883e7f53bdd83a471dd0
3
+ metadata.gz: f45921dd1eae37420883610af8fa98376812b220f8bb19d15ad418eeeaf3926b
4
+ data.tar.gz: 3a05c27b2457b4920993430a334534a0b41f2b92d4b5b5f99de8ab8ba4b69ca2
5
5
  SHA512:
6
- metadata.gz: 8a32d059e758d8bdd370cefb0e445e03db4f46bb2a0faf19b2754d3dc0faf7cbb3dabab69c3e89253fc3e09600b453c1f56ed87efd730515de53768524603372
7
- data.tar.gz: 795d9c1c1c3bf9f3f38007a771463c6a46290f11445755c30ce0b712c903a729d4bf2b3048a70f5118abe12075dfbc3a1a65a3b6443056768d8bad0b95655aa4
6
+ metadata.gz: ba901db425ebad3cf7755b83ff07f81da266d63ae3370448ed473653fcdbad7b12585c5e6c2675be8f14db49e00b68fad19ceb30ea7af0147b817c02184ce1d6
7
+ data.tar.gz: de56b8153970b889b4a56ebec2662ef8a7eff9378a69fe4164c3cd2393f02e71b7ddcc0c396bcdd94978d6a4d2e67ce3bf65c7fcce3c6626e5733c493b24ba0a
data/Changelog.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  - Add your change HERE
4
4
 
5
+ # 2.23.0
6
+ - Add FFaker::BankUS.accounting_number [@professor]
7
+ - Add FFaker::BankUS.routing_number [@professor]
8
+ - Resolve a lot of RuboCop offenses [@AlexWayfer]
9
+ - Change `Image.url`, `Image.file`, `Book.cover` and `Avatar.image` arguments to keywords [@AlexWayfer]
10
+ - Adds FFaker::Date.birthday [@professor]
11
+ - Adds FFaker::Crypto.sha256 [@professor]
12
+ - Update README [@professor]
13
+ - Adds FFaker::Number.between [@professor]
14
+ - Fixed `FFaker::Number.unique.number(digits: 1)` under Ruby 3 [@simonhildebrandt]
15
+
16
+ # 2.22.0
17
+ - *BREAKING CHANGE*: Drop support under ruby 2.7 [@marocchino]
18
+ - Correct Vehicle::VIN result [@philippevezina]
19
+ - Improve performance unique [@iiwo]
20
+ - Drop gemspec generation in rake [@technicalpickles]
21
+ - Add identification EC [@josieljunior]
22
+ - Update data for AddressDE [@slowjack2k]
23
+ - Add ruby 3.2 to CI [@petergoldstein]
24
+ - Add JoJo module [@ar2em1s]
25
+ - Fix crash in FFaker::Time#datetime when defining FFaker::Date module [@brupla6126]
26
+
5
27
  ## 2.21.0
6
28
  - Generate valid VINs [@xunker]
7
29
  - Add neighborhood and address complement to AddressBR [@az3vedo]
@@ -10,7 +32,7 @@
10
32
  - Add Ruby 3.1 to CI matrix [@petergoldstein]
11
33
  - Add AnimalBr [@thiago-henrique-leite]
12
34
  - Fix rubocop warnings [@mmrshk]
13
- - Consistently generate REFERENCE.md [@technicalpickles and @Volosh1n]
35
+ - Consistently generate REFERENCE.md [@technicalpickles] and [@Volosh1n]
14
36
 
15
37
  ## 2.20.0
16
38
  - Remove date from gem specification [@AlexWayfer]
@@ -33,7 +55,7 @@
33
55
  - Test with Github actions & Ruby 3 [@marocchino]
34
56
  - Generate reference by CI [@marocchino]
35
57
  - Change the regex to cover all scenarios in lorem_fr [@abnersajr]
36
- - Add "Freedom Ipsum" text generator option [@hmaack and @lynnd335]
58
+ - Add "Freedom Ipsum" text generator option [@hmaack] and [@lynnd335]
37
59
  - Fix issues with `FFaker::Image` module [@hmaack]
38
60
  - Fix typo in animal.rb module [@renius]
39
61
 
@@ -196,21 +218,6 @@
196
218
  - many internal library and test suite refactorings
197
219
 
198
220
 
199
- [#181]: https://github.com/ffaker/ffaker/issues/181
200
- [#191]: https://github.com/ffaker/ffaker/issues/191
201
- [#193]: https://github.com/ffaker/ffaker/issues/193
202
- [#195]: https://github.com/ffaker/ffaker/issues/195
203
- [#196]: https://github.com/ffaker/ffaker/issues/196
204
- [#199]: https://github.com/ffaker/ffaker/issues/199
205
- [#200]: https://github.com/ffaker/ffaker/issues/200
206
- [#203]: https://github.com/ffaker/ffaker/issues/203
207
- [#211]: https://github.com/ffaker/ffaker/pull/211
208
- [#212]: https://github.com/ffaker/ffaker/pull/212
209
- [#213]: https://github.com/ffaker/ffaker/pull/213
210
- [@marocchino]: https://github.com/marocchino
211
- [@rstacruz]: https://github.com/rstacruz
212
- [@anderscarling]: https://github.com/anderscarling
213
-
214
221
 
215
222
  ## 2.0.0
216
223
  - switched faker to ffaker namespace, you should now be able to use
@@ -420,3 +427,110 @@ Api additions by Rafael Souza
420
427
  ## 0.1.0 2007-11-22
421
428
 
422
429
  * Initial release
430
+
431
+ [#181]: https://github.com/ffaker/ffaker/issues/181
432
+ [#191]: https://github.com/ffaker/ffaker/issues/191
433
+ [#193]: https://github.com/ffaker/ffaker/issues/193
434
+ [#195]: https://github.com/ffaker/ffaker/issues/195
435
+ [#196]: https://github.com/ffaker/ffaker/issues/196
436
+ [#199]: https://github.com/ffaker/ffaker/issues/199
437
+ [#200]: https://github.com/ffaker/ffaker/issues/200
438
+ [#203]: https://github.com/ffaker/ffaker/issues/203
439
+ [#211]: https://github.com/ffaker/ffaker/pull/211
440
+ [#212]: https://github.com/ffaker/ffaker/pull/212
441
+ [#213]: https://github.com/ffaker/ffaker/pull/213
442
+ [@44uk]: https://github.com/44uk
443
+ [@AlexAvlonitis]: https://github.com/AlexAvlonitis
444
+ [@AlexWayfer]: https://github.com/AlexWayfer
445
+ [@CarlosMouraJR]: https://github.com/CarlosMouraJR
446
+ [@GuillaumeOcculy]: https://github.com/GuillaumeOcculy
447
+ [@IgorMarques]: https://github.com/IgorMarques
448
+ [@Kutomore]: https://github.com/Kutomore
449
+ [@MQuy]: https://github.com/MQuy
450
+ [@Moafak]: https://github.com/Moafak
451
+ [@Phanithism]: https://github.com/Phanithism
452
+ [@Sephyros]: https://github.com/Sephyros
453
+ [@SteveRedka]: https://github.com/SteveRedka
454
+ [@Volosh1n]: https://github.com/Volosh1n
455
+ [@YutaGoto]: https://github.com/YutaGoto
456
+ [@aaronsama]: https://github.com/aaronsama
457
+ [@abnersajr]: https://github.com/abnersajr
458
+ [@adimircolen]: https://github.com/adimircolen
459
+ [@alagu]: https://github.com/alagu
460
+ [@alibby]: https://github.com/alibby
461
+ [@anderscarling]: https://github.com/anderscarling
462
+ [@andyklimczak]: https://github.com/andyklimczak
463
+ [@ar2em1s]: https://github.com/ar2em1s
464
+ [@artplan1]: https://github.com/artplan1
465
+ [@az3vedo]: https://github.com/az3vedo
466
+ [@brain64bit]: https://github.com/brain64bit
467
+ [@brnrdog]: https://github.com/brnrdog
468
+ [@brupla6126]: https://github.com/brupla6126
469
+ [@ckyOL]: https://github.com/ckyOL
470
+ [@danderozier]: https://github.com/danderozier
471
+ [@dankimio]: https://github.com/dankimio
472
+ [@delucas]: https://github.com/delucas
473
+ [@dimroc]: https://github.com/dimroc
474
+ [@dphurley]: https://github.com/dphurley
475
+ [@eikes]: https://github.com/eikes
476
+ [@falegk]: https://github.com/falegk
477
+ [@firedev]: https://github.com/firedev
478
+ [@gabrielcosta42]: https://github.com/gabrielcosta42
479
+ [@gerard76]: https://github.com/gerard76
480
+ [@gruz0]: https://github.com/gruz0
481
+ [@hmaack]: https://github.com/hmaack
482
+ [@hulous]: https://github.com/hulous
483
+ [@iamarmanjon]: https://github.com/iamarmanjon
484
+ [@iiwo]: https://github.com/iiwo
485
+ [@j0al]: https://github.com/j0al
486
+ [@jakubm]: https://github.com/jakubm
487
+ [@jasonleonhard]: https://github.com/jasonleonhard
488
+ [@joshdvir]: https://github.com/joshdvir
489
+ [@josieljunior]: https://github.com/josieljunior
490
+ [@jvanbaarsen]: https://github.com/jvanbaarsen
491
+ [@kmayer]: https://github.com/kmayer
492
+ [@kojino]: https://github.com/kojino
493
+ [@ktroutner]: https://github.com/ktroutner
494
+ [@lilsweetcaligula]: https://github.com/lilsweetcaligula
495
+ [@lynnd335]: https://github.com/lynnd335
496
+ [@makketagg]: https://github.com/makketagg
497
+ [@marocchino]: https://github.com/marocchino
498
+ [@max-si-m]: https://github.com/max-si-m
499
+ [@mechos3d]: https://github.com/mechos3d
500
+ [@metalelf0]: https://github.com/metalelf0
501
+ [@miscelatore]: https://github.com/miscelatore
502
+ [@mklemme]: https://github.com/mklemme
503
+ [@mmrshk]: https://github.com/mmrshk
504
+ [@nav16]: https://github.com/nav16
505
+ [@ni3t]: https://github.com/ni3t
506
+ [@nicholaskillin]: https://github.com/nicholaskillin
507
+ [@nicolas-brousse]: https://github.com/nicolas-brousse
508
+ [@nigelgomesot]: https://github.com/nigelgomesot
509
+ [@pawelma]: https://github.com/pawelma
510
+ [@petergoldstein]: https://github.com/petergoldstein
511
+ [@philippevezina]: https://github.com/philippevezina
512
+ [@pominx]: https://github.com/pominx
513
+ [@professor]: https://github.com/professor
514
+ [@renius]: https://github.com/renius
515
+ [@rgcamus]: https://github.com/rgcamus
516
+ [@robin]: https://github.com/robin
517
+ [@rocknruby]: https://github.com/rocknruby
518
+ [@rstacruz]: https://github.com/rstacruz
519
+ [@rvisuvasam]: https://github.com/rvisuvasam
520
+ [@simonhildebrandt]: https://github.com/simonhildebrandt
521
+ [@slowjack2k]: https://github.com/slowjack2k
522
+ [@spheric]: https://github.com/spheric
523
+ [@steverovsky]: https://github.com/steverovsky
524
+ [@stilist]: https://github.com/stilist
525
+ [@tatey]: https://github.com/tatey
526
+ [@technicalpickles]: https://github.com/technicalpickles
527
+ [@thiago-henrique-leite]: https://github.com/thiago-henrique-leite
528
+ [@thilonel]: https://github.com/thilonel
529
+ [@thutterer]: https://github.com/thutterer
530
+ [@timfanda35]: https://github.com/timfanda35
531
+ [@tvarley]: https://github.com/tvarley
532
+ [@ulzr]: https://github.com/ulzr
533
+ [@vinhnglx]: https://github.com/vinhnglx
534
+ [@waldyr]: https://github.com/waldyr
535
+ [@walerian777]: https://github.com/walerian777
536
+ [@xunker]: https://github.com/xunker
data/Gemfile CHANGED
@@ -1,4 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  source 'https://rubygems.org'
4
+
4
5
  gemspec
6
+
7
+ group :development do
8
+ gem 'rake', '~> 13.0'
9
+ end
10
+
11
+ group :development, :lint do
12
+ gem 'rubocop'
13
+ gem 'rubocop-performance'
14
+ gem 'rubocop-rake'
15
+ end
16
+
17
+ group :development, :test do
18
+ gem 'test-unit'
19
+ end
data/README.md CHANGED
@@ -77,12 +77,23 @@ name will be set with data from `ffaker/data/name/first_names`.
77
77
 
78
78
  To get repeatable results in Minitest or Rspec, follow [these instructions](RANDOM.md#using-the-same-random-seed-as-your-tests).
79
79
 
80
- ## Unique results
80
+ ## Unique values
81
81
 
82
- You can get unique value from any methods in FFaker like this:
82
+ You can ensure unique values are generated using the `unique` method. `ffaker` will retry the generation
83
+ until an unique value if found.
83
84
 
84
- ```rb
85
- FFaker::Name.unique.name
85
+ Example:
86
+ ```ruby
87
+ FFaker::Name.unique.name # ensures an unique value is returned for FFaker::Name
88
+ ```
89
+
90
+ If an unique value cannot be generated within a maximum limit of retries for a generator
91
+ a `FFaker::UniqueUtils::RetryLimitExceeded` error will be raised.
92
+
93
+ You can prevent exceeding the limit by clearing the record of used values (e.g. between tests):
94
+ ```ruby
95
+ FFaker::Name.unique.clear # clears the used values for FFaker::Name
96
+ FFaker::UniqueUtils.clear # clears the used values for all generators
86
97
  ```
87
98
 
88
99
  ## TODO
@@ -94,8 +105,9 @@ FFaker::Name.unique.name
94
105
 
95
106
  * Fork the project.
96
107
  * Make your feature addition or bug fix.
97
- * Add tests for it. This is important so I don't break it in a
98
- future version unintentionally.
108
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
109
+ * To run all the tests: `rake test`
110
+ * To run a single test: `rake test TEST=test/test_lorem_br.rb`
99
111
  * Commit, do not mess with rakefile, version, or history.
100
112
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
101
113
  * Send me a pull request. Bonus points for topic branches.