ffaker 2.12.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +28 -0
  3. data/README.md +8 -1
  4. data/REFERENCE.md +1365 -1234
  5. data/Rakefile +0 -6
  6. data/ffaker.gemspec +14 -5
  7. data/lib/ffaker.rb +12 -6
  8. data/lib/ffaker/address_fr.rb +5 -1
  9. data/lib/ffaker/address_nl.rb +1 -3
  10. data/lib/ffaker/address_us.rb +22 -2
  11. data/lib/ffaker/{animals.rb → animal.rb} +0 -0
  12. data/lib/ffaker/{animals_cn.rb → animal_cn.rb} +0 -0
  13. data/lib/ffaker/animal_es.rb +12 -0
  14. data/lib/ffaker/{animals_us.rb → animal_us.rb} +0 -0
  15. data/lib/ffaker/bank.rb +15 -3
  16. data/lib/ffaker/code.rb +17 -0
  17. data/lib/ffaker/color_pl.rb +14 -0
  18. data/lib/ffaker/company_ja.rb +24 -0
  19. data/lib/ffaker/data/address_fr/region +27 -0
  20. data/lib/ffaker/data/address_ja/city +0 -23
  21. data/lib/ffaker/data/address_us/state_abbr +0 -1
  22. data/lib/ffaker/data/animal_es/common_names +135 -0
  23. data/lib/ffaker/data/bank/card_types +12 -0
  24. data/lib/ffaker/data/book/nouns +2 -2
  25. data/lib/ffaker/data/color_pl/names_list +122 -0
  26. data/lib/ffaker/data/filesystem/extension +31 -31
  27. data/lib/ffaker/data/movie/nouns +2 -2
  28. data/lib/ffaker/data/name/first_names_female +0 -230
  29. data/lib/ffaker/data/name/first_names_male +0 -37
  30. data/lib/ffaker/data/sport_pl/summer +53 -0
  31. data/lib/ffaker/data/sport_pl/winter +14 -0
  32. data/lib/ffaker/data/vehicle/color_prefixes +25 -0
  33. data/lib/ffaker/education.rb +4 -8
  34. data/lib/ffaker/education_cn.rb +3 -6
  35. data/lib/ffaker/filesystem.rb +7 -7
  36. data/lib/ffaker/identification_in.rb +15 -0
  37. data/lib/ffaker/identification_kr.rb +2 -2
  38. data/lib/ffaker/identification_mx.rb +1 -1
  39. data/lib/ffaker/identification_pl.rb +77 -0
  40. data/lib/ffaker/identification_tw.rb +23 -0
  41. data/lib/ffaker/internet.rb +4 -6
  42. data/lib/ffaker/internet_se.rb +1 -1
  43. data/lib/ffaker/name_mx.rb +2 -2
  44. data/lib/ffaker/phone_number_br.rb +2 -2
  45. data/lib/ffaker/product.rb +1 -1
  46. data/lib/ffaker/sport_pl.rb +25 -0
  47. data/lib/ffaker/ssn.rb +1 -3
  48. data/lib/ffaker/string.rb +5 -5
  49. data/lib/ffaker/unit.rb +9 -10
  50. data/lib/ffaker/unit_english.rb +18 -19
  51. data/lib/ffaker/unit_metric.rb +15 -16
  52. data/lib/ffaker/utils/random_utils.rb +2 -0
  53. data/lib/ffaker/utils/unique_utils.rb +0 -2
  54. data/lib/ffaker/vehicle.rb +1 -6
  55. data/lib/version.rb +5 -0
  56. data/scripts/benchmark.rb +10 -11
  57. data/test/helper.rb +35 -0
  58. data/test/test_address_au.rb +2 -2
  59. data/test/test_address_br.rb +1 -1
  60. data/test/test_address_fi.rb +2 -2
  61. data/test/test_address_fr.rb +1 -1
  62. data/test/test_address_id.rb +1 -1
  63. data/test/test_address_ja.rb +1 -1
  64. data/test/test_address_nl.rb +1 -1
  65. data/test/test_address_se.rb +2 -2
  66. data/test/test_address_us.rb +9 -0
  67. data/test/test_animal_es.rb +17 -0
  68. data/test/test_array_utils.rb +0 -1
  69. data/test/test_aws.rb +1 -1
  70. data/test/test_bank.rb +41 -5
  71. data/test/test_book.rb +4 -4
  72. data/test/test_code.rb +22 -1
  73. data/test/test_color_pl.rb +13 -0
  74. data/test/test_company_ja.rb +28 -0
  75. data/test/{test_faker.rb → test_ffaker.rb} +5 -1
  76. data/test/test_filesystem.rb +11 -3
  77. data/test/test_geolocation.rb +2 -2
  78. data/test/test_healthcare_ru.rb +1 -1
  79. data/test/test_html_ipsum.rb +1 -1
  80. data/test/test_identification_co.rb +2 -2
  81. data/test/test_identification_es_cl.rb +1 -1
  82. data/test/test_identification_in.rb +20 -0
  83. data/test/test_identification_pl.rb +28 -0
  84. data/test/test_identification_tw.rb +17 -0
  85. data/test/test_image.rb +3 -3
  86. data/test/test_internet.rb +9 -9
  87. data/test/test_internet_se.rb +1 -1
  88. data/test/test_job_cn.rb +1 -1
  89. data/test/test_job_ja.rb +1 -1
  90. data/test/test_job_kr.rb +1 -1
  91. data/test/test_job_vn.rb +1 -1
  92. data/test/test_lorem_cn.rb +6 -6
  93. data/test/test_lorem_ja.rb +3 -3
  94. data/test/test_lorem_pl.rb +1 -1
  95. data/test/test_lorem_ru.rb +1 -1
  96. data/test/test_lorem_ua.rb +1 -1
  97. data/test/test_music.rb +4 -4
  98. data/test/test_name_da.rb +3 -3
  99. data/test/test_phone_number_se.rb +2 -2
  100. data/test/test_sport_pl.rb +30 -0
  101. data/test/test_ssn_se.rb +6 -8
  102. data/test/test_string.rb +3 -3
  103. data/test/test_time.rb +13 -6
  104. data/test/test_tweet.rb +9 -9
  105. data/test/test_vehicle.rb +2 -2
  106. metadata +201 -162
  107. data/lib/ffaker/data/address_jp/city +0 -127
  108. data/lib/ffaker/data/address_jp/designated_city +0 -20
  109. data/lib/ffaker/data/address_jp/street +0 -37
  110. data/lib/ffaker/data/address_jp/tokyo_ward +0 -23
  111. data/lib/ffaker/data/address_jp/village +0 -183
  112. data/lib/ffaker/data/address_jp/ward +0 -188
@@ -30,8 +30,8 @@ class TestGeolocation < Test::Unit::TestCase
30
30
 
31
31
  new_coords = FFaker::Geolocation.boxed_coords(coords[0], coords[1])
32
32
 
33
- assert (lat_min..lat_max).cover?new_coords[0]
34
- assert (lon_min..lon_max).cover?new_coords[1]
33
+ assert (lat_min..lat_max).cover? new_coords[0]
34
+ assert (lon_min..lon_max).cover? new_coords[1]
35
35
  end
36
36
  end
37
37
  end
@@ -5,7 +5,7 @@ require 'helper'
5
5
  class TestHealthcareRU < Test::Unit::TestCase
6
6
  include DeterministicHelper
7
7
 
8
- SPECIALIZATION_REGEX = /\A[А-Яа-я\ \(\)\-]+\z/.freeze
8
+ SPECIALIZATION_REGEX = /\A[А-Яа-я\ ()\-]+\z/.freeze
9
9
 
10
10
  assert_methods_are_deterministic(FFaker::HealthcareRU, :doctor_specialization)
11
11
 
@@ -28,7 +28,7 @@ class TestHTMLIpsum < Test::Unit::TestCase
28
28
 
29
29
  def test_p_breaks
30
30
  # Here we can at least test how many <br> tags there are.
31
- assert_match(%r{^<p>(?:[ \w\.]+<br>){2}[ \w\.]+</p>$}i, FFaker::HTMLIpsum.p(3, include_breaks: true))
31
+ assert_match(%r{^<p>(?:[ \w.]+<br>){2}[ \w.]+</p>$}i, FFaker::HTMLIpsum.p(3, include_breaks: true))
32
32
  end
33
33
 
34
34
  def test_p_fancy
@@ -28,7 +28,7 @@ class TestFakerIdentificationESCO < Test::Unit::TestCase
28
28
  end
29
29
 
30
30
  def test_category
31
- assert_match(/\A([a][1-2]|[bc][1-3])\z/i, @tester.driver_license_category)
31
+ assert_match(/\A(a[1-2]|[bc][1-3])\z/i, @tester.driver_license_category)
32
32
  end
33
33
 
34
34
  def test_blood_type
@@ -36,6 +36,6 @@ class TestFakerIdentificationESCO < Test::Unit::TestCase
36
36
  end
37
37
 
38
38
  def test_expedition_date
39
- assert(Date.today >= @tester.expedition_date)
39
+ assert_less_than @tester.expedition_date, Date.today
40
40
  end
41
41
  end
@@ -12,6 +12,6 @@ class TestFakerIdentificationESCL < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_rut
15
- assert_match(/\b\d{7,8}\-[k|0-9]/i, @tester.rut)
15
+ assert_match(/\b\d{7,8}-[k|0-9]/i, @tester.rut)
16
16
  end
17
17
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'helper'
4
+
5
+ class TestIdentificationIN < Test::Unit::TestCase
6
+ include DeterministicHelper
7
+
8
+ assert_methods_are_deterministic(
9
+ FFaker::IdentificationIN,
10
+ :aadhaar
11
+ )
12
+
13
+ def setup
14
+ @tester = FFaker::IdentificationIN
15
+ end
16
+
17
+ def test_aadhaar
18
+ assert_match(/\A\d{12}\z/, @tester.aadhaar)
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'helper'
4
+
5
+ class TestFakerIdentificationPL < Test::Unit::TestCase
6
+ include DeterministicHelper
7
+
8
+ assert_methods_are_deterministic(
9
+ FFaker::IdentificationPL,
10
+ :pesel, :identity_card, :drivers_license
11
+ )
12
+
13
+ def setup
14
+ @tester = FFaker::IdentificationPL
15
+ end
16
+
17
+ def test_pesel
18
+ assert_match(/\A\d{11}\z/, @tester.pesel)
19
+ end
20
+
21
+ def test_identity_card
22
+ assert_match(/\A[A-Z]{3}\d{6}\z/, @tester.identity_card)
23
+ end
24
+
25
+ def test_drivers_license
26
+ assert_match(%r{\A\d{5}/\d{2}/\d{4}\z}, @tester.drivers_license)
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'helper'
4
+
5
+ class TestFakerIdentificationTW < Test::Unit::TestCase
6
+ include DeterministicHelper
7
+
8
+ assert_methods_are_deterministic(FFaker::IdentificationTW, :id)
9
+
10
+ def setup
11
+ @tester = FFaker::IdentificationTW
12
+ end
13
+
14
+ def test_id
15
+ assert_match(/\A[A-Z][12]\d{8}\z/, @tester.id)
16
+ end
17
+ end
@@ -14,7 +14,7 @@ class TestImage < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  def test_url
17
- assert_match(%r(#{Regexp.quote(PLACEHOLDER)}300x300\/[0-9a-f]{6}\/[0-9a-f]{6}\.png\?text=),
17
+ assert_match(%r(#{Regexp.quote(PLACEHOLDER)}300x300/[0-9a-f]{6}/[0-9a-f]{6}\.png\?text=),
18
18
  @tester.url)
19
19
  end
20
20
 
@@ -24,7 +24,7 @@ class TestImage < Test::Unit::TestCase
24
24
  end
25
25
 
26
26
  def test_image_url_with_correct_size
27
- assert_match(%r(#{Regexp.quote(PLACEHOLDER)}150x320\/[0-9a-f]{6}\/[0-9a-f]{6}\.png\?text=),
27
+ assert_match(%r(#{Regexp.quote(PLACEHOLDER)}150x320/[0-9a-f]{6}/[0-9a-f]{6}\.png\?text=),
28
28
  @tester.url('150x320'))
29
29
  end
30
30
 
@@ -35,7 +35,7 @@ class TestImage < Test::Unit::TestCase
35
35
  end
36
36
 
37
37
  def test_image_url_with_supported_format
38
- assert_match(%r(#{Regexp.quote(PLACEHOLDER)}300x300\/[0-9a-f]{6}\/[0-9a-f]{6}\.jpg\?text=),
38
+ assert_match(%r(#{Regexp.quote(PLACEHOLDER)}300x300/[0-9a-f]{6}/[0-9a-f]{6}\.jpg\?text=),
39
39
  @tester.url('300x300', 'jpg'))
40
40
  end
41
41
 
@@ -93,15 +93,15 @@ class TestFakerInternet < Test::Unit::TestCase
93
93
  end
94
94
 
95
95
  def test_password_min_length
96
- assert @tester.password(3).length > 2
97
- assert @tester.password(6).length > 5
98
- assert @tester.password(15).length > 14
96
+ assert_greater_than @tester.password(3).length, 2
97
+ assert_greater_than @tester.password(6).length, 5
98
+ assert_greater_than @tester.password(15).length, 14
99
99
  end
100
100
 
101
101
  def test_password_max_length
102
- assert @tester.password(3, 10).length < 11
103
- assert @tester.password(7, 15).length < 16
104
- assert @tester.password(1, 3).length < 4
102
+ assert_less_than @tester.password(3, 10).length, 11
103
+ assert_less_than @tester.password(7, 15).length, 16
104
+ assert_less_than @tester.password(1, 3).length, 4
105
105
  end
106
106
 
107
107
  def test_password_fixed_length
@@ -109,9 +109,9 @@ class TestFakerInternet < Test::Unit::TestCase
109
109
  end
110
110
 
111
111
  def test_password_strange_argument
112
- assert @tester.password(10, 2).length > 9
113
- assert @tester.password(3, 1).length > 2
114
- assert @tester.password(8, 5).length > 7
112
+ assert_greater_than @tester.password(10, 2).length, 9
113
+ assert_greater_than @tester.password(3, 1).length, 2
114
+ assert_greater_than @tester.password(8, 5).length, 7
115
115
  end
116
116
 
117
117
  def test_mac
@@ -73,6 +73,6 @@ class TestFakerInternetSE < Test::Unit::TestCase
73
73
  end
74
74
 
75
75
  def test_slug
76
- assert @tester.slug.match(/^[a-z]+(_|\.|\-)[a-z]+$/)
76
+ assert @tester.slug.match(/^[a-z]+(_|\.|-)[a-z]+$/)
77
77
  end
78
78
  end
@@ -12,7 +12,7 @@ class TestFakerJobCN < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_title
15
- assert @tester.title.length >= 1
15
+ assert_greater_than_or_equal_to @tester.title.length, 1
16
16
  end
17
17
 
18
18
  def test_nouns
@@ -12,7 +12,7 @@ class TestFakerJobJA < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_title
15
- assert @tester.title.length >= 1
15
+ assert_greater_than_or_equal_to @tester.title.length, 1
16
16
  end
17
17
 
18
18
  def test_nouns
@@ -12,7 +12,7 @@ class TestFakerJobKR < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_title
15
- assert @tester.title.length >= 1
15
+ assert_greater_than_or_equal_to @tester.title.length, 1
16
16
  end
17
17
 
18
18
  def test_nouns
@@ -12,7 +12,7 @@ class TestFakerJobVN < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  def test_title
15
- assert @tester.title.length >= 1
15
+ assert_greater_than_or_equal_to @tester.title.length, 1
16
16
  end
17
17
 
18
18
  def test_nouns
@@ -11,15 +11,15 @@ class TestLoremCN < Test::Unit::TestCase
11
11
  )
12
12
 
13
13
  def test_paragraph
14
- assert FFaker::LoremCN.paragraph.length >= 3 * 4 * 2
14
+ assert_greater_than_or_equal_to FFaker::LoremCN.paragraph.length, 3 * 4 * 2
15
15
  end
16
16
 
17
17
  def test_sentence
18
- assert FFaker::LoremCN.sentence.length >= 4 * 2
18
+ assert_greater_than_or_equal_to FFaker::LoremCN.sentence.length, 4 * 2
19
19
  end
20
20
 
21
21
  def test_paragraphs
22
- assert FFaker::LoremCN.paragraphs.length >= 2
22
+ assert_greater_than_or_equal_to FFaker::LoremCN.paragraphs.length, 2
23
23
  end
24
24
 
25
25
  def test_paragraphs_is_not_a_string_representation_of_an_array
@@ -31,7 +31,7 @@ class TestLoremCN < Test::Unit::TestCase
31
31
  end
32
32
 
33
33
  def test_sentences
34
- assert FFaker::LoremCN.sentences.length >= 2
34
+ assert_greater_than_or_equal_to FFaker::LoremCN.sentences.length, 2
35
35
  end
36
36
 
37
37
  def test_sentences_is_an_array
@@ -45,10 +45,10 @@ class TestLoremCN < Test::Unit::TestCase
45
45
  end
46
46
 
47
47
  def test_words
48
- assert FFaker::LoremCN.words.length >= 2
48
+ assert_greater_than_or_equal_to FFaker::LoremCN.words.length, 2
49
49
  end
50
50
 
51
51
  def test_word
52
- assert FFaker::LoremCN.word.length >= 1
52
+ assert_greater_than_or_equal_to FFaker::LoremCN.word.length, 1
53
53
  end
54
54
  end
@@ -33,7 +33,7 @@ class TestLoremJA < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  def test_word
36
- assert @subject.word.length >= 1
36
+ assert_greater_than_or_equal_to @subject.word.length, 1
37
37
  assert_kind_of String, @subject.word
38
38
  end
39
39
 
@@ -48,7 +48,7 @@ class TestLoremJA < Test::Unit::TestCase
48
48
  end
49
49
 
50
50
  def test_sentence
51
- assert @subject.sentence.length >= 1
51
+ assert_greater_than_or_equal_to @subject.sentence.length, 1
52
52
  end
53
53
 
54
54
  def test_sentences
@@ -62,7 +62,7 @@ class TestLoremJA < Test::Unit::TestCase
62
62
  end
63
63
 
64
64
  def test_paragraph
65
- assert @subject.paragraph.length >= 1
65
+ assert_greater_than_or_equal_to @subject.paragraph.length, 1
66
66
  end
67
67
 
68
68
  def test_paragraphs
@@ -6,7 +6,7 @@ class TestFakerLoremPL < Test::Unit::TestCase
6
6
  include DeterministicHelper
7
7
 
8
8
  POLISH_WORD_MATCHER = /\A[A-Ża-ż\s]+\z/.freeze
9
- POLISH_SENTENCE_MATCHER = /\A[A-Ża-ż\s\.\!\?,]+\z/.freeze
9
+ POLISH_SENTENCE_MATCHER = /\A[A-Ża-ż\s.!?,]+\z/.freeze
10
10
 
11
11
  assert_methods_are_deterministic(
12
12
  FFaker::LoremPL,
@@ -5,7 +5,7 @@ require 'helper'
5
5
  class TestLoremRU < Test::Unit::TestCase
6
6
  include DeterministicHelper
7
7
 
8
- SENTENCE_MATCHER = /\A[а-яА-ЯёЁ\-\s\.\!\?,]+\z/.freeze
8
+ SENTENCE_MATCHER = /\A[а-яА-ЯёЁ\-\s.!?,]+\z/.freeze
9
9
  WORDS_MATCHER = /\A[А-Яа-яёЁ\-\s]+\z/.freeze
10
10
  WORD_MATCHER = /\A[А-Яа-яёЁ\-]+\z/.freeze
11
11
 
@@ -5,7 +5,7 @@ require 'helper'
5
5
  class TestLoremUA < Test::Unit::TestCase
6
6
  include DeterministicHelper
7
7
 
8
- SENTENCE_MATCHER = /\A[а-яА-ЯіїєґІЇЄҐ’\-\s\.\!\?,]+\z/.freeze
8
+ SENTENCE_MATCHER = /\A[а-яА-ЯіїєґІЇЄҐ’\-\s.!?,]+\z/.freeze
9
9
  WORDS_MATCHER = /\A[а-яА-ЯіїєґІЇЄҐ’\-\s]+\z/.freeze
10
10
  WORD_MATCHER = /\A[а-яА-ЯіїєґІЇЄҐ’\-]+\z/.freeze
11
11
 
@@ -11,18 +11,18 @@ class TestMusic < Test::Unit::TestCase
11
11
  )
12
12
 
13
13
  def test_genre
14
- assert_match(%r{[A-z]|\W|\&/+}, FFaker::Music.genre)
14
+ assert_match(%r{[A-z]|\W|&/+}, FFaker::Music.genre)
15
15
  end
16
16
 
17
17
  def test_album
18
- assert_match(/\s|[A-z]|\W|\d|\'|\?+/, FFaker::Music.album)
18
+ assert_match(/\s|[A-z]|\W|\d|'|\?+/, FFaker::Music.album)
19
19
  end
20
20
 
21
21
  def test_artist
22
- assert_match(/\s|[A-z]|\W|\d|\'|\?|\&|\+|\.|\-+/, FFaker::Music.artist)
22
+ assert_match(/\s|[A-z]|\W|\d|'|\?|&|\+|\.|-+/, FFaker::Music.artist)
23
23
  end
24
24
 
25
25
  def test_song
26
- assert_match(/\s|[A-z]|\W|\d|\'|\?|\&|\+|\.|\-+/, FFaker::Music.song)
26
+ assert_match(/\s|[A-z]|\W|\d|'|\?|&|\+|\.|-+/, FFaker::Music.song)
27
27
  end
28
28
  end
@@ -23,18 +23,18 @@ class TestFakerNameDA < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  def test_any_name
26
- assert @tester.any_name.count(' ') < 3
26
+ assert_less_than @tester.any_name.count(' '), 3
27
27
  end
28
28
 
29
29
  def test_male_name
30
30
  regexp = /#{@tester::MALE_FIRST_NAMES.join('|')}/
31
- assert @tester.male_name.count(' ') < 3
31
+ assert_less_than @tester.male_name.count(' '), 3
32
32
  assert_match(regexp, @tester.male_name)
33
33
  end
34
34
 
35
35
  def test_female_name
36
36
  regexp = /#{@tester::FEMALE_FIRST_NAMES.join('|')}/
37
- assert @tester.female_name.count(' ') < 3
37
+ assert_less_than @tester.female_name.count(' '), 3
38
38
  assert_match(regexp, @tester.female_name)
39
39
  end
40
40
 
@@ -33,13 +33,13 @@ class TestPhoneNumberSE < Test::Unit::TestCase
33
33
  def test_mobile_phone_number
34
34
  assert_match(ALLOWED_CHARS, FFaker::PhoneNumberSE.mobile_phone_number)
35
35
  assert_match(/\d{3}/, FFaker::PhoneNumberSE.mobile_phone_number)
36
- assert FFaker::PhoneNumberSE.mobile_phone_number.length > 9
36
+ assert_greater_than FFaker::PhoneNumberSE.mobile_phone_number.length, 9
37
37
  end
38
38
 
39
39
  def test_home_work_phone_number
40
40
  assert_match(ALLOWED_CHARS, FFaker::PhoneNumberSE.home_work_phone_number)
41
41
  assert_match(/\d{1} \d{2}/, FFaker::PhoneNumberSE.home_work_phone_number)
42
- assert FFaker::PhoneNumberSE.mobile_phone_number.length > 9
42
+ assert_greater_than FFaker::PhoneNumberSE.mobile_phone_number.length, 9
43
43
  end
44
44
 
45
45
  def test_phone_number
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'helper'
4
+
5
+ class TestSportPL < Test::Unit::TestCase
6
+ include DeterministicHelper
7
+
8
+ assert_methods_are_deterministic(
9
+ FFaker::SportPL,
10
+ :name,
11
+ :summer,
12
+ :winter
13
+ )
14
+
15
+ def setup
16
+ @tester = FFaker::SportPL
17
+ end
18
+
19
+ def test_name
20
+ assert_include(@tester::ALL, @tester.name)
21
+ end
22
+
23
+ def test_summer
24
+ assert_include(@tester::SUMMER, @tester.summer)
25
+ end
26
+
27
+ def test_winter
28
+ assert_include(@tester::WINTER, @tester.winter)
29
+ end
30
+ end
@@ -12,8 +12,8 @@ class TestSSNSE < Test::Unit::TestCase
12
12
  assert_match(/(19|20)\d{10}/, ssn, "With no arguments year should start with 19 or 20, #{ssn}")
13
13
  end
14
14
 
15
- def equal?(nbr)
16
- nbr % 2
15
+ def equal?(other)
16
+ other % 2
17
17
  end
18
18
 
19
19
  def test_ssn_with_gender
@@ -29,17 +29,15 @@ class TestSSNSE < Test::Unit::TestCase
29
29
  end
30
30
 
31
31
  def test_ssn_with_from_to
32
- 10.times do
33
- from = Time.local(1980, 2, 28)
34
- to = Time.local(2000, 2, 28)
32
+ from = Time.local(1980, 2, 28)
33
+ to = Time.local(2000, 2, 28)
35
34
 
35
+ assert_random_between(from, to, exclude_end: true) do
36
36
  ssn = FFaker::SSNSE.ssn(from: from, to: to)
37
37
  year = ssn[0..3].to_i
38
38
  month = ssn[4..5].to_i
39
39
  day = ssn[6..7].to_i
40
- ssn_birth_date = Time.local(year, month, day)
41
- assert ssn_birth_date < to
42
- assert ssn_birth_date >= from
40
+ Time.local(year, month, day)
43
41
  end
44
42
  end
45
43
  end