ffaker 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +32 -0
  3. data/README.md +7 -6
  4. data/REFERENCE.md +1355 -0
  5. data/Rakefile +6 -6
  6. data/ffaker.gemspec +16 -3
  7. data/lib/ffaker.rb +1 -1
  8. data/lib/ffaker/address_ca.rb +3 -3
  9. data/lib/ffaker/avatar.rb +20 -0
  10. data/lib/ffaker/bacon_ipsum.rb +1 -1
  11. data/lib/ffaker/data/job_cn/job_nouns +300 -0
  12. data/lib/ffaker/data/sport/names +34 -0
  13. data/lib/ffaker/dizzle_ipsum.rb +1 -1
  14. data/lib/ffaker/healthcare_ipsum.rb +1 -1
  15. data/lib/ffaker/hipster_ipsum.rb +1 -1
  16. data/lib/ffaker/html_ipsum.rb +1 -1
  17. data/lib/ffaker/identification_kr.rb +20 -0
  18. data/lib/ffaker/identification_mx.rb +3 -3
  19. data/lib/ffaker/internet.rb +3 -3
  20. data/lib/ffaker/internet_se.rb +1 -1
  21. data/lib/ffaker/job_cn.rb +12 -0
  22. data/lib/ffaker/job_fr.rb +6 -2
  23. data/lib/ffaker/locale.rb +1 -1
  24. data/lib/ffaker/lorem.rb +7 -5
  25. data/lib/ffaker/lorem_ar.rb +1 -1
  26. data/lib/ffaker/lorem_cn.rb +1 -1
  27. data/lib/ffaker/lorem_fr.rb +1 -1
  28. data/lib/ffaker/lorem_kr.rb +1 -1
  29. data/lib/ffaker/movie.rb +6 -0
  30. data/lib/ffaker/phone_number.rb +46 -17
  31. data/lib/ffaker/product.rb +1 -1
  32. data/lib/ffaker/skill.rb +1 -1
  33. data/lib/ffaker/sport.rb +10 -0
  34. data/lib/ffaker/string.rb +22 -11
  35. data/lib/ffaker/utils/array_utils.rb +4 -3
  36. data/lib/ffaker/vehicle.rb +1 -1
  37. data/scripts/reference.rb +89 -0
  38. data/test/test_address_ca.rb +6 -4
  39. data/test/test_array_utils.rb +3 -3
  40. data/test/test_avatar.rb +50 -0
  41. data/test/test_company.rb +8 -6
  42. data/test/test_identification.rb +5 -4
  43. data/test/test_identification_kr.rb +13 -0
  44. data/test/test_internet.rb +4 -0
  45. data/test/test_job.rb +1 -2
  46. data/test/test_job_cn.rb +17 -0
  47. data/test/test_job_fr.rb +4 -7
  48. data/test/test_job_ja.rb +1 -1
  49. data/test/test_job_kr.rb +1 -1
  50. data/test/test_locale.rb +21 -0
  51. data/test/test_lorem_kr.rb +1 -1
  52. data/test/test_movie.rb +8 -0
  53. data/test/test_name.rb +3 -3
  54. data/test/test_name_br.rb +7 -8
  55. data/test/test_name_cs.rb +8 -6
  56. data/test/test_name_de.rb +3 -3
  57. data/test/test_name_fr.rb +15 -17
  58. data/test/test_name_ga.rb +12 -14
  59. data/test/test_name_it.rb +14 -15
  60. data/test/test_name_ja.rb +1 -1
  61. data/test/test_name_mx.rb +82 -80
  62. data/test/test_name_nb.rb +6 -9
  63. data/test/test_name_nl.rb +3 -3
  64. data/test/test_name_ph.rb +12 -2
  65. data/test/test_name_ru.rb +14 -10
  66. data/test/test_name_se.rb +6 -9
  67. data/test/test_name_sn.rb +39 -52
  68. data/test/test_name_th.rb +7 -9
  69. data/test/test_phone_number.rb +9 -0
  70. data/test/test_sports.rb +13 -0
  71. data/test/test_string.rb +26 -16
  72. data/test/test_units.rb +8 -10
  73. data/test/test_units_english.rb +15 -22
  74. data/test/test_units_metric.rb +15 -21
  75. metadata +22 -4
@@ -9,7 +9,7 @@ class TestFakerNameCS < Test::Unit::TestCase
9
9
 
10
10
  def test_name
11
11
  @words = @tester.name.split
12
- assert [2,3,4].include?(@words.size) # just name, or prefix, or prefix+suffix
12
+ assert_include([2, 3, 4], @words.size) # just name, or prefix, or prefix+suffix
13
13
  end
14
14
 
15
15
  def test_name_sex
@@ -19,19 +19,19 @@ class TestFakerNameCS < Test::Unit::TestCase
19
19
  end
20
20
 
21
21
  def test_male_last_name
22
- assert FFaker::NameCS::LAST_NAMES[:male].include?(@tester.last_name(:male))
22
+ assert_include(@tester::LAST_NAMES[:male], @tester.last_name(:male))
23
23
  end
24
24
 
25
25
  def test_male_first_name
26
- assert FFaker::NameCS::FIRST_NAMES[:male].include?(@tester.first_name(:male))
26
+ assert_include(@tester::FIRST_NAMES[:male], @tester.first_name(:male))
27
27
  end
28
28
 
29
29
  def test_prefix
30
- assert FFaker::NameCS::PREFIXES.include?(@tester.prefix)
30
+ assert_include(@tester::PREFIXES, @tester.prefix)
31
31
  end
32
32
 
33
33
  def test_suffix
34
- assert FFaker::NameCS::SUFFIXES.include?(@tester.suffix)
34
+ assert_include(@tester::SUFFIXES, @tester.suffix)
35
35
  end
36
36
 
37
37
  def test_with_same_sex
@@ -52,11 +52,13 @@ class TestFakerNameCS < Test::Unit::TestCase
52
52
  assert same_sex?(names, :male)
53
53
  end
54
54
 
55
+ private
56
+
55
57
  # checks if every name is of the same sex
56
58
  def same_sex?(words, sex = :any)
57
59
  (sex == :any ? [:male, :female] : [sex]).any? do |sex|
58
60
  words.all? do |word|
59
- [FFaker::NameCS::LAST_NAMES, FFaker::NameCS::FIRST_NAMES].any? do |names|
61
+ [@tester::LAST_NAMES, @tester::FIRST_NAMES].any? do |names|
60
62
  names[sex].include?(word)
61
63
  end
62
64
  end
@@ -8,14 +8,14 @@ class TestFakerNameDE < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_name
11
- assert @tester.name.match(/(\w+\.? ?){2,3}/)
11
+ assert_match(/\A([\w']+\.? ?){2,3}\z/, @tester.name)
12
12
  end
13
13
 
14
14
  def test_prefix
15
- assert @tester.prefix.match(/[A-Z][a-z]+\.?/)
15
+ assert_match(/\A[A-Z][a-z]+\.?\z/, @tester.prefix)
16
16
  end
17
17
 
18
18
  def test_suffix
19
- assert @tester.suffix.match(/[A-Z][a-z]*\.?/)
19
+ assert_include(@tester::SUFFIXES, @tester.suffix)
20
20
  end
21
21
  end
@@ -4,45 +4,43 @@ require 'helper'
4
4
 
5
5
  # Author: PapePathe<pathe.sene@gmail.com> github.com/PapePathe
6
6
  class TestFakerNameFR < Test::Unit::TestCase
7
-
8
7
  def setup
9
8
  @tester = FFaker::NameFR
10
9
  end
11
10
 
12
11
  def test_last_name
13
- assert FFaker::NameFR::LAST_NAMES.include?(@tester.last_name)
12
+ assert_include @tester::LAST_NAMES, @tester.last_name
14
13
  end
15
14
 
16
15
  def test_first_name
17
- assert FFaker::NameFR::FIRST_NAMES.include?(@tester.first_name)
16
+ assert_include @tester::FIRST_NAMES, @tester.first_name
18
17
  end
19
18
 
20
19
  def test_prefix
21
- assert FFaker::NameFR::PREFIX.include?(@tester.prefix)
20
+ assert_include @tester::PREFIX, @tester.prefix
22
21
  end
23
22
 
24
-
25
23
  def test_name
26
24
  # => split the name into an array of words
27
25
  parts = @tester.name.split(' ')
28
-
29
- if parts.count == 3
26
+ case parts.count
27
+ when 3
28
+ first_name, prefix, last_name = parts
30
29
  # the value at the index 1 should be a valid! prefix
31
- assert FFaker::NameFR::PREFIX.include?(parts[1])
30
+ assert_include @tester::PREFIX, prefix
32
31
 
33
- # the value at the index 0 should be a valid! male_first_name
34
- assert FFaker::NameFR::FIRST_NAMES.include?(parts[0])
32
+ # the value at the index 0 should be a valid! first_name
33
+ assert_include @tester::FIRST_NAMES, first_name
35
34
 
36
35
  # the value at the index 2 should be a valid! last_name
37
- assert FFaker::NameFR::LAST_NAMES.include?(parts[2])
38
-
39
- elsif parts.count == 2
40
- # the value at the index 0 should be a valid! prefix
41
- assert FFaker::NameFR::FIRST_NAMES.include?(parts[0])
36
+ assert_include @tester::LAST_NAMES, last_name
37
+ when 2
38
+ first_name, last_name = parts
39
+ # the value at the index 0 should be a valid! first_name
40
+ assert_include @tester::FIRST_NAMES, first_name
42
41
 
43
42
  # the value at the index 1 should be a valid! last_name
44
- assert FFaker::NameFR::LAST_NAMES.include?(parts[1])
43
+ assert_include @tester::LAST_NAMES, last_name
45
44
  end
46
45
  end
47
-
48
46
  end
@@ -3,54 +3,52 @@
3
3
  require 'helper'
4
4
 
5
5
  class TestFakerNameGa < Test::Unit::TestCase
6
-
7
6
  def setup
8
7
  @tester = FFaker::NameGA
9
8
  end
10
9
 
11
10
  def test_last_name
12
- assert FFaker::NameGA::LAST_NAMES.include?(@tester.last_name)
11
+ assert_include @tester::LAST_NAMES, @tester.last_name
13
12
  end
14
13
 
15
14
  def test_first_name_male
16
- assert FFaker::NameGA::FIRST_NAMES_MALE.include?(@tester.first_name_male)
15
+ assert_include @tester::FIRST_NAMES_MALE, @tester.first_name_male
17
16
  end
18
17
 
19
18
  def test_first_name_female
20
- assert FFaker::NameGA::FIRST_NAMES_FEMALE.include?(@tester.first_name_female)
19
+ assert_include @tester::FIRST_NAMES_FEMALE, @tester.first_name_female
21
20
  end
22
21
 
23
22
  def test_name_male
24
23
  # => split the name_male into an array of words
25
- parts = @tester.name_male.split(' ')
24
+ first_name, last_name = @tester.name_male.split(' ')
26
25
 
27
26
  # the value at the index 0 should be a valid! male_prefix
28
- assert FFaker::NameGA::FIRST_NAMES_MALE.include?(parts[0])
27
+ assert_include @tester::FIRST_NAMES_MALE, first_name
29
28
 
30
29
  # the value at the index 1 should be a valid! last_name
31
- assert FFaker::NameGA::LAST_NAMES.include?(parts[1])
30
+ assert_include @tester::LAST_NAMES, last_name
32
31
  end
33
32
 
34
33
  def test_name_female
35
34
  # => split the name_male into an array of words
36
- parts = @tester.name_female.split(' ')
35
+ first_name, last_name = @tester.name_female.split(' ')
37
36
 
38
37
  # the value at the index 0 should be a valid! male_prefix
39
- assert FFaker::NameGA::FIRST_NAMES_FEMALE.include?(parts[0])
38
+ assert_include @tester::FIRST_NAMES_FEMALE, first_name
40
39
 
41
40
  # the value at the index 1 should be a valid! last_name
42
- assert FFaker::NameGA::LAST_NAMES.include?(parts[1])
41
+ assert_include @tester::LAST_NAMES, last_name
43
42
  end
44
43
 
45
-
46
44
  def test_name
47
45
  # => split the name_male into an array of words
48
- parts = @tester.name.split(' ')
46
+ first_name, last_name = @tester.name.split(' ')
49
47
 
50
48
  # the value at the index 0 should be a valid! male_prefix
51
- assert FFaker::NameGA::FIRST_NAMES_FEMALE.include?(parts[0]) || FFaker::NameGA::FIRST_NAMES_MALE.include?(parts[0])
49
+ assert_include(@tester::FIRST_NAMES_FEMALE + @tester::FIRST_NAMES_MALE, first_name)
52
50
 
53
51
  # the value at the index 1 should be a valid! last_name
54
- assert FFaker::NameGA::LAST_NAMES.include?(parts[1])
52
+ assert_include @tester::LAST_NAMES, last_name
55
53
  end
56
54
  end
@@ -4,45 +4,44 @@ require 'helper'
4
4
 
5
5
  # Author: PapePathe<pathe.sene@gmail.com> github.com/PapePathe
6
6
  class TestFakerNameIT < Test::Unit::TestCase
7
-
8
7
  def setup
9
8
  @tester = FFaker::NameIT
10
9
  end
11
10
 
12
11
  def test_last_name
13
- assert FFaker::NameIT::LAST_NAMES.include?(@tester.last_name)
12
+ assert_include @tester::LAST_NAMES, @tester.last_name
14
13
  end
15
14
 
16
15
  def test_first_name
17
- assert FFaker::NameIT::FIRST_NAMES.include?(@tester.first_name)
16
+ assert_include @tester::FIRST_NAMES, @tester.first_name
18
17
  end
19
18
 
20
19
  def test_prefix
21
- assert FFaker::NameIT::PREFIX.include?(@tester.prefix)
20
+ assert_include @tester::PREFIX, @tester.prefix
22
21
  end
23
22
 
24
-
25
23
  def test_name
26
24
  # => split the name into an array of words
27
25
  parts = @tester.name.split(' ')
28
26
 
29
- if parts.count == 3
27
+ case parts.count
28
+ when 3
29
+ prefix, first_name, last_name = parts
30
30
  # the value at the index 0 should be a valid! prefix
31
- assert FFaker::NameIT::PREFIX.include?(parts[0])
31
+ assert_include @tester::PREFIX, prefix
32
32
 
33
33
  # the value at the index 1 should be a valid! first_name
34
- assert FFaker::NameIT::FIRST_NAMES.include?(parts[1])
34
+ assert_include @tester::FIRST_NAMES, first_name
35
35
 
36
36
  # the value at the index 2 should be a valid! last_name
37
- assert FFaker::NameIT::LAST_NAMES.include?(parts[2])
38
-
39
- elsif parts.count == 2
40
- # the value at the index 0 should be a valid! prefix
41
- assert FFaker::NameIT::FIRST_NAMES.include?(parts[0])
37
+ assert_include @tester::LAST_NAMES, last_name
38
+ when 2
39
+ first_name, last_name = parts
40
+ # the value at the index 0 should be a valid! first_name
41
+ assert_include @tester::FIRST_NAMES, first_name
42
42
 
43
43
  # the value at the index 1 should be a valid! last_name
44
- assert FFaker::NameIT::LAST_NAMES.include?(parts[1])
44
+ assert_include @tester::LAST_NAMES, last_name
45
45
  end
46
46
  end
47
-
48
47
  end
@@ -8,6 +8,6 @@ class TestFakerNameJA < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_name
11
- assert FFaker::NameJA.name.length >= 2
11
+ assert @tester.name.length >= 2
12
12
  end
13
13
  end
@@ -4,55 +4,58 @@ require 'helper'
4
4
 
5
5
  # Author: guapolo github.com/guapolo
6
6
  class TestFakerNameMX < Test::Unit::TestCase
7
-
8
7
  def setup
9
8
  @tester = FFaker::NameMX
10
- @all_names = FFaker::NameMX::MALE_FIRST_NAMES + FFaker::NameMX::FEMALE_FIRST_NAMES
9
+ @all_names = @tester::MALE_FIRST_NAMES + @tester::FEMALE_FIRST_NAMES
11
10
  end
12
11
 
13
12
  def test_last_name
14
- assert FFaker::NameMX::LAST_NAMES.include?(@tester.last_name)
13
+ assert_include @tester::LAST_NAMES, @tester.last_name
15
14
  end
16
15
 
17
16
  def test_first_name
18
- assert @all_names.include?(@tester.first_name)
17
+ assert_include @all_names, @tester.first_name
19
18
  end
20
19
 
21
20
  def test_middle_name
22
- assert @all_names.include?(@tester.middle_name)
21
+ assert_include @all_names, @tester.middle_name
23
22
  end
24
23
 
25
24
  def test_name
26
- assert @all_names.include?(@tester.name)
25
+ assert_include @all_names, @tester.name
27
26
  end
28
27
 
29
28
  def test_prefix_male
30
- assert FFaker::NameMX::MALE_PREFIXES.include?(@tester.male_prefix)
29
+ assert_include @tester::MALE_PREFIXES, @tester.male_prefix
31
30
  end
32
31
 
33
32
  def test_prefix_female
34
- assert FFaker::NameMX::FEMALE_PREFIXES.include?(@tester.female_prefix)
33
+ assert_include @tester::FEMALE_PREFIXES, @tester.female_prefix
35
34
  end
36
35
 
37
36
  def test_prefix
38
- assert FFaker::NameMX::PREFIXES.include?(@tester.prefix)
37
+ assert_include @tester::PREFIXES, @tester.prefix
39
38
  end
40
39
 
41
40
  def test_male_name
42
41
  parts = @tester.male_name.split(' ')
43
42
  case parts.count
44
- when 1 then assert FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[0])
45
- when 2 then assert FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[0]) &&
46
- FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[1])
43
+ when 1
44
+ assert_include @tester::MALE_FIRST_NAMES, parts[0]
45
+ when 2
46
+ assert_include @tester::MALE_FIRST_NAMES, parts[0]
47
+ assert_include @tester::MALE_FIRST_NAMES, parts[1]
47
48
  end
48
49
  end
49
50
 
50
51
  def test_female_name
51
52
  parts = @tester.female_name.split(' ')
52
53
  case parts.count
53
- when 1 then assert FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[0])
54
- when 2 then assert FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[0]) &&
55
- FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[1])
54
+ when 1
55
+ assert_include @tester::FEMALE_FIRST_NAMES, parts[0]
56
+ when 2
57
+ assert_include @tester::FEMALE_FIRST_NAMES, parts[0]
58
+ assert_include @tester::FEMALE_FIRST_NAMES, parts[1]
56
59
  end
57
60
  end
58
61
 
@@ -60,25 +63,25 @@ class TestFakerNameMX < Test::Unit::TestCase
60
63
  parts = @tester.full_name(:male).split(' ')
61
64
  case parts.count
62
65
  when 5
63
- assert FFaker::NameMX::MALE_PREFIXES.include?(parts[0])
64
- assert FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[1])
66
+ assert_include @tester::MALE_PREFIXES, parts[0]
67
+ assert_include @tester::MALE_FIRST_NAMES, parts[1]
65
68
  # Middle name
66
- assert FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[2])
67
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
68
- assert FFaker::NameMX::LAST_NAMES.include?(parts[4])
69
+ assert_include @tester::MALE_FIRST_NAMES, parts[2]
70
+ assert_include @tester::LAST_NAMES, parts[3]
71
+ assert_include @tester::LAST_NAMES, parts[4]
69
72
  when 4
70
- prefix_or_first_name = FFaker::NameMX::MALE_PREFIXES.include?(parts[0]) ||
71
- FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[0])
73
+ prefix_or_first_name = @tester::MALE_PREFIXES.include?(parts[0]) ||
74
+ @tester::MALE_FIRST_NAMES.include?(parts[0])
72
75
  assert prefix_or_first_name
73
- assert FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[1])
74
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
75
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
76
+ assert_include @tester::MALE_FIRST_NAMES, parts[1]
77
+ assert_include @tester::LAST_NAMES, parts[2]
78
+ assert_include @tester::LAST_NAMES, parts[3]
76
79
  when 3
77
- assert FFaker::NameMX::MALE_FIRST_NAMES.include?(parts[0])
78
- assert FFaker::NameMX::LAST_NAMES.include?(parts[1])
79
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
80
+ assert_include @tester::MALE_FIRST_NAMES, parts[0]
81
+ assert_include @tester::LAST_NAMES, parts[1]
82
+ assert_include @tester::LAST_NAMES, parts[2]
80
83
  else
81
- flunk "Invalid Male Name"
84
+ flunk 'Invalid Male Name'
82
85
  end
83
86
  end
84
87
 
@@ -86,25 +89,25 @@ class TestFakerNameMX < Test::Unit::TestCase
86
89
  parts = @tester.full_name(:female).split(' ')
87
90
  case parts.count
88
91
  when 5
89
- assert FFaker::NameMX::FEMALE_PREFIXES.include?(parts[0])
90
- assert FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[1])
92
+ assert_include @tester::FEMALE_PREFIXES, parts[0]
93
+ assert_include @tester::FEMALE_FIRST_NAMES, parts[1]
91
94
  # Middle name
92
- assert FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[2])
93
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
94
- assert FFaker::NameMX::LAST_NAMES.include?(parts[4])
95
+ assert_include @tester::FEMALE_FIRST_NAMES, parts[2]
96
+ assert_include @tester::LAST_NAMES, parts[3]
97
+ assert_include @tester::LAST_NAMES, parts[4]
95
98
  when 4
96
- prefix_or_first_name = FFaker::NameMX::FEMALE_PREFIXES.include?(parts[0]) ||
97
- FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[0])
99
+ prefix_or_first_name = @tester::FEMALE_PREFIXES.include?(parts[0]) ||
100
+ @tester::FEMALE_FIRST_NAMES.include?(parts[0])
98
101
  assert prefix_or_first_name
99
- assert FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[1])
100
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
101
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
102
+ assert_include @tester::FEMALE_FIRST_NAMES, parts[1]
103
+ assert_include @tester::LAST_NAMES, parts[2]
104
+ assert_include @tester::LAST_NAMES, parts[3]
102
105
  when 3
103
- assert FFaker::NameMX::FEMALE_FIRST_NAMES.include?(parts[0])
104
- assert FFaker::NameMX::LAST_NAMES.include?(parts[1])
105
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
106
+ assert_include @tester::FEMALE_FIRST_NAMES, parts[0]
107
+ assert_include @tester::LAST_NAMES, parts[1]
108
+ assert_include @tester::LAST_NAMES, parts[2]
106
109
  else
107
- flunk "Invalid Female Name"
110
+ flunk 'Invalid Female Name'
108
111
  end
109
112
  end
110
113
 
@@ -112,25 +115,25 @@ class TestFakerNameMX < Test::Unit::TestCase
112
115
  parts = @tester.full_name.split(' ')
113
116
  case parts.count
114
117
  when 5
115
- assert FFaker::NameMX::PREFIXES.include?(parts[0])
116
- assert @all_names.include?(parts[1])
118
+ assert_include @tester::PREFIXES, parts[0]
119
+ assert_include @all_names, parts[1]
117
120
  # Middle name
118
- assert @all_names.include?(parts[2])
119
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
120
- assert FFaker::NameMX::LAST_NAMES.include?(parts[4])
121
+ assert_include @all_names, parts[2]
122
+ assert_include @tester::LAST_NAMES, parts[3]
123
+ assert_include @tester::LAST_NAMES, parts[4]
121
124
  when 4
122
- prefix_or_first_name = FFaker::NameMX::PREFIXES.include?(parts[0]) ||
123
- @all_names.include?(parts[0])
125
+ prefix_or_first_name = @tester::PREFIXES.include?(parts[0]) ||
126
+ @all_names.include?(parts[0])
124
127
  assert prefix_or_first_name
125
- assert @all_names.include?(parts[1])
126
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
127
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
128
+ assert_include @all_names, parts[1]
129
+ assert_include @tester::LAST_NAMES, parts[2]
130
+ assert_include @tester::LAST_NAMES, parts[3]
128
131
  when 3
129
- assert @all_names.include?(parts[0])
130
- assert FFaker::NameMX::LAST_NAMES.include?(parts[1])
131
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
132
+ assert_include @all_names, parts[0]
133
+ assert_include @tester::LAST_NAMES, parts[1]
134
+ assert_include @tester::LAST_NAMES, parts[2]
132
135
  else
133
- flunk "Invalid Name"
136
+ flunk 'Invalid Name'
134
137
  end
135
138
  end
136
139
 
@@ -138,16 +141,16 @@ class TestFakerNameMX < Test::Unit::TestCase
138
141
  parts = @tester.full_name_no_prefix.split(' ')
139
142
  case parts.count
140
143
  when 4
141
- assert @all_names.include?(parts[0])
142
- assert @all_names.include?(parts[1])
143
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
144
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
144
+ assert_include @all_names, parts[0]
145
+ assert_include @all_names, parts[1]
146
+ assert_include @tester::LAST_NAMES, parts[2]
147
+ assert_include @tester::LAST_NAMES, parts[3]
145
148
  when 3
146
- assert @all_names.include?(parts[0])
147
- assert FFaker::NameMX::LAST_NAMES.include?(parts[1])
148
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
149
+ assert_include @all_names, parts[0]
150
+ assert_include @tester::LAST_NAMES, parts[1]
151
+ assert_include @tester::LAST_NAMES, parts[2]
149
152
  else
150
- flunk "Invalid Name"
153
+ flunk 'Invalid Name'
151
154
  end
152
155
  end
153
156
 
@@ -155,26 +158,25 @@ class TestFakerNameMX < Test::Unit::TestCase
155
158
  parts = @tester.full_name_prefix.split(' ')
156
159
  case parts.count
157
160
  when 5
158
- assert FFaker::NameMX::PREFIXES.include?(parts[0])
159
- assert @all_names.include?(parts[1])
161
+ assert_include @tester::PREFIXES, parts[0]
162
+ assert_include @all_names, parts[1]
160
163
  # Middle name
161
- assert @all_names.include?(parts[2])
162
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
163
- assert FFaker::NameMX::LAST_NAMES.include?(parts[4])
164
+ assert_include @all_names, parts[2]
165
+ assert_include @tester::LAST_NAMES, parts[3]
166
+ assert_include @tester::LAST_NAMES, parts[4]
164
167
  when 4
165
- prefix_or_first_name = FFaker::NameMX::PREFIXES.include?(parts[0]) ||
166
- @all_names.include?(parts[0])
168
+ prefix_or_first_name = @tester::PREFIXES.include?(parts[0]) ||
169
+ @all_names.include?(parts[0])
167
170
  assert prefix_or_first_name
168
- assert @all_names.include?(parts[1])
169
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
170
- assert FFaker::NameMX::LAST_NAMES.include?(parts[3])
171
+ assert_include @all_names, parts[1]
172
+ assert_include @tester::LAST_NAMES, parts[2]
173
+ assert_include @tester::LAST_NAMES, parts[3]
171
174
  when 3
172
- assert @all_names.include?(parts[0])
173
- assert FFaker::NameMX::LAST_NAMES.include?(parts[1])
174
- assert FFaker::NameMX::LAST_NAMES.include?(parts[2])
175
+ assert_include @all_names, parts[0]
176
+ assert_include @tester::LAST_NAMES, parts[1]
177
+ assert_include @tester::LAST_NAMES, parts[2]
175
178
  else
176
- flunk "Invalid Name"
179
+ flunk 'Invalid Name'
177
180
  end
178
181
  end
179
-
180
182
  end