ffaker 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +34 -0
- data/README.md +4 -0
- data/REFERENCE.md +1153 -800
- data/Rakefile +23 -24
- data/ffaker.gemspec +12 -420
- data/lib/ffaker.rb +47 -7
- data/lib/ffaker/address.rb +11 -11
- data/lib/ffaker/address_au.rb +60 -60
- data/lib/ffaker/address_br.rb +5 -5
- data/lib/ffaker/address_ca.rb +7 -7
- data/lib/ffaker/address_ch.rb +1 -2
- data/lib/ffaker/address_ch_de.rb +1 -1
- data/lib/ffaker/address_ch_fr.rb +1 -1
- data/lib/ffaker/address_ch_it.rb +1 -1
- data/lib/ffaker/address_da.rb +5 -5
- data/lib/ffaker/address_de.rb +16 -12
- data/lib/ffaker/address_fi.rb +7 -8
- data/lib/ffaker/address_fr.rb +13 -13
- data/lib/ffaker/address_gr.rb +40 -0
- data/lib/ffaker/address_in.rb +12 -12
- data/lib/ffaker/address_kr.rb +87 -0
- data/lib/ffaker/address_mx.rb +409 -409
- data/lib/ffaker/address_nl.rb +17 -13
- data/lib/ffaker/address_ru.rb +6 -6
- data/lib/ffaker/address_se.rb +7 -8
- data/lib/ffaker/address_sn.rb +3 -3
- data/lib/ffaker/address_ua.rb +8 -8
- data/lib/ffaker/address_uk.rb +5 -5
- data/lib/ffaker/address_us.rb +9 -9
- data/lib/ffaker/airline.rb +16 -0
- data/lib/ffaker/avatar.rb +3 -3
- data/lib/ffaker/aws.rb +24 -0
- data/lib/ffaker/bacon_ipsum.rb +2 -2
- data/lib/ffaker/book.rb +45 -0
- data/lib/ffaker/boolean.rb +2 -2
- data/lib/ffaker/cheesy_lingo.rb +15 -12
- data/lib/ffaker/color.rb +54 -1
- data/lib/ffaker/color_ua.rb +1 -1
- data/lib/ffaker/company.rb +13 -11
- data/lib/ffaker/company_cn.rb +23 -0
- data/lib/ffaker/company_it.rb +4 -4
- data/lib/ffaker/company_se.rb +2 -2
- data/lib/ffaker/conference.rb +1 -1
- data/lib/ffaker/courses.rb +2 -3
- data/lib/ffaker/currency.rb +2 -2
- data/lib/ffaker/data/address_gr/city +79 -0
- data/lib/ffaker/data/address_gr/region +13 -0
- data/lib/ffaker/data/address_gr/street +100 -0
- data/lib/ffaker/data/address_kr/boroughs +29 -0
- data/lib/ffaker/data/address_kr/cities +51 -0
- data/lib/ffaker/data/airline/codes_list +209 -0
- data/lib/ffaker/data/airline/names_list +206 -0
- data/lib/ffaker/data/aws/ec2_instance_type +59 -0
- data/lib/ffaker/data/aws/ec2_reserved_instance_tenancy +3 -0
- data/lib/ffaker/data/aws/ec2_reserved_offering_type +6 -0
- data/lib/ffaker/data/aws/ec2_reserved_product_description +14 -0
- data/lib/ffaker/data/book/adj_and_adv +20 -0
- data/lib/ffaker/data/book/genres +369 -0
- data/lib/ffaker/data/book/nouns +36 -0
- data/lib/ffaker/data/book/prefixes +17 -0
- data/lib/ffaker/data/color/names_list +128 -0
- data/lib/ffaker/data/education/degree_prefix +274 -0
- data/lib/ffaker/data/education/degree_short_prefix +19 -0
- data/lib/ffaker/data/job_br/job_nouns +52 -0
- data/lib/ffaker/data/job_vn/job_nouns +191 -0
- data/lib/ffaker/data/lorem_ja/characters +101 -0
- data/lib/ffaker/data/lorem_ja/sentences +30 -0
- data/lib/ffaker/data/lorem_ja/sentences_end +21 -0
- data/lib/ffaker/data/lorem_ja/words +81 -0
- data/lib/ffaker/data/name/first_names_female +4275 -0
- data/lib/ffaker/data/name/first_names_male +1219 -0
- data/lib/ffaker/data/name_br/first_names_female +1068 -0
- data/lib/ffaker/data/name_br/first_names_male +607 -0
- data/lib/ffaker/data/name_br/last_names +52 -0
- data/lib/ffaker/data/name_gr/female_first_names +80 -0
- data/lib/ffaker/data/name_gr/female_last_names +45 -0
- data/lib/ffaker/data/name_gr/male_first_names +90 -0
- data/lib/ffaker/data/name_gr/male_last_names +57 -0
- data/lib/ffaker/data/name_kh/first_names +64 -0
- data/lib/ffaker/data/name_kh/last_names +71 -0
- data/lib/ffaker/data/name_kh/nick_names +30 -0
- data/lib/ffaker/data/name_then/first_names +292 -0
- data/lib/ffaker/data/name_then/last_names +63 -0
- data/lib/ffaker/data/name_then/nick_names +30 -0
- data/lib/ffaker/data/phone_number/phone_calling_code +205 -0
- data/lib/ffaker/data/sport/names +57 -24
- data/lib/ffaker/data/tweet/hashtag +58 -0
- data/lib/ffaker/data/youtube/video_ids +50 -0
- data/lib/ffaker/dizzle_ipsum.rb +2 -2
- data/lib/ffaker/education.rb +17 -16
- data/lib/ffaker/food.rb +5 -6
- data/lib/ffaker/gender.rb +4 -4
- data/lib/ffaker/gender_br.rb +17 -0
- data/lib/ffaker/gender_cn.rb +4 -4
- data/lib/ffaker/gender_kr.rb +4 -4
- data/lib/ffaker/geolocation.rb +26 -26
- data/lib/ffaker/healthcare_ipsum.rb +2 -2
- data/lib/ffaker/hipster_ipsum.rb +2 -2
- data/lib/ffaker/html_ipsum.rb +101 -81
- data/lib/ffaker/identification.rb +4 -4
- data/lib/ffaker/identification_br.rb +84 -0
- data/lib/ffaker/identification_es.rb +2 -2
- data/lib/ffaker/identification_es_cl.rb +7 -5
- data/lib/ffaker/identification_es_co.rb +9 -10
- data/lib/ffaker/identification_kr.rb +3 -4
- data/lib/ffaker/identification_mx.rb +27 -11
- data/lib/ffaker/internet.rb +26 -23
- data/lib/ffaker/internet_se.rb +21 -21
- data/lib/ffaker/job.rb +1 -1
- data/lib/ffaker/job_br.rb +12 -0
- data/lib/ffaker/job_cn.rb +1 -1
- data/lib/ffaker/job_fr.rb +3 -3
- data/lib/ffaker/job_ja.rb +2 -1
- data/lib/ffaker/job_kr.rb +1 -1
- data/lib/ffaker/job_vn.rb +13 -0
- data/lib/ffaker/locale.rb +2 -3
- data/lib/ffaker/lorem.rb +5 -5
- data/lib/ffaker/lorem_ar.rb +4 -4
- data/lib/ffaker/lorem_cn.rb +3 -3
- data/lib/ffaker/lorem_fr.rb +4 -4
- data/lib/ffaker/lorem_ja.rb +40 -0
- data/lib/ffaker/lorem_kr.rb +4 -4
- data/lib/ffaker/lorem_ua.rb +8 -11
- data/lib/ffaker/movie.rb +18 -20
- data/lib/ffaker/music.rb +4 -4
- data/lib/ffaker/name.rb +100 -11
- data/lib/ffaker/name_br.rb +37 -6
- data/lib/ffaker/name_cn.rb +2 -2
- data/lib/ffaker/name_cs.rb +10 -10
- data/lib/ffaker/name_da.rb +6 -6
- data/lib/ffaker/name_de.rb +5 -5
- data/lib/ffaker/name_fr.rb +4 -4
- data/lib/ffaker/name_ga.rb +4 -5
- data/lib/ffaker/name_gr.rb +60 -0
- data/lib/ffaker/name_it.rb +4 -4
- data/lib/ffaker/name_ja.rb +3 -3
- data/lib/ffaker/name_kh.rb +22 -0
- data/lib/ffaker/name_kr.rb +3 -3
- data/lib/ffaker/name_mx.rb +14 -14
- data/lib/ffaker/name_nb.rb +5 -5
- data/lib/ffaker/name_nl.rb +7 -7
- data/lib/ffaker/name_ph.rb +2 -2
- data/lib/ffaker/name_ru.rb +7 -8
- data/lib/ffaker/name_se.rb +5 -5
- data/lib/ffaker/name_sn.rb +23 -23
- data/lib/ffaker/name_th.rb +3 -3
- data/lib/ffaker/name_th_en.rb +26 -0
- data/lib/ffaker/name_ua.rb +8 -8
- data/lib/ffaker/name_vn.rb +4 -4
- data/lib/ffaker/nato_alphabet.rb +10 -10
- data/lib/ffaker/phone_number.rb +31 -21
- data/lib/ffaker/phone_number_au.rb +3 -3
- data/lib/ffaker/phone_number_br.rb +9 -8
- data/lib/ffaker/phone_number_ch.rb +7 -7
- data/lib/ffaker/phone_number_cu.rb +5 -5
- data/lib/ffaker/phone_number_de.rb +1 -1
- data/lib/ffaker/phone_number_fr.rb +4 -4
- data/lib/ffaker/phone_number_it.rb +2 -2
- data/lib/ffaker/phone_number_kr.rb +4 -4
- data/lib/ffaker/phone_number_mx.rb +4 -5
- data/lib/ffaker/phone_number_nl.rb +13 -13
- data/lib/ffaker/phone_number_se.rb +18 -19
- data/lib/ffaker/phone_number_sg.rb +8 -8
- data/lib/ffaker/phone_number_sn.rb +2 -2
- data/lib/ffaker/product.rb +18 -14
- data/lib/ffaker/skill.rb +3 -3
- data/lib/ffaker/sport.rb +1 -1
- data/lib/ffaker/ssn_se.rb +19 -20
- data/lib/ffaker/string.rb +21 -23
- data/lib/ffaker/time.rb +19 -7
- data/lib/ffaker/tweet.rb +59 -0
- data/lib/ffaker/unit.rb +12 -12
- data/lib/ffaker/unit_english.rb +34 -35
- data/lib/ffaker/unit_metric.rb +25 -25
- data/lib/ffaker/utils/array_utils.rb +12 -9
- data/lib/ffaker/utils/module_utils.rb +9 -6
- data/lib/ffaker/utils/random_utils.rb +33 -0
- data/lib/ffaker/vehicle.rb +21 -21
- data/lib/ffaker/venue.rb +1 -1
- data/lib/ffaker/youtube.rb +24 -0
- data/scripts/benchmark.rb +3 -3
- data/scripts/reference.rb +26 -23
- data/test/helper.rb +50 -0
- data/test/test_address.rb +40 -21
- data/test/test_address_au.rb +19 -9
- data/test/test_address_br.rb +9 -2
- data/test/test_address_ca.rb +7 -0
- data/test/test_address_ch.rb +6 -2
- data/test/test_address_ch_de.rb +7 -3
- data/test/test_address_ch_fr.rb +7 -3
- data/test/test_address_ch_it.rb +5 -1
- data/test/test_address_da.rb +18 -9
- data/test/test_address_de.rb +12 -5
- data/test/test_address_fi.rb +10 -3
- data/test/test_address_fr.rb +13 -0
- data/test/test_address_gr.rb +43 -0
- data/test/test_address_in.rb +20 -12
- data/test/test_address_kr.rb +14 -0
- data/test/test_address_mx.rb +12 -5
- data/test/test_address_nl.rb +11 -5
- data/test/test_address_ru.rb +11 -5
- data/test/test_address_se.rb +9 -3
- data/test/test_address_sn.rb +7 -1
- data/test/test_address_ua.rb +17 -10
- data/test/test_address_uk.rb +11 -3
- data/test/test_address_us.rb +15 -6
- data/test/test_airline.rb +17 -0
- data/test/test_array_utils.rb +51 -3
- data/test/test_avatar.rb +5 -1
- data/test/test_aws.rb +25 -0
- data/test/test_bacon_ipsum.rb +12 -6
- data/test/test_book.rb +41 -0
- data/test/test_boolean.rb +4 -0
- data/test/test_cheesy_lingo.rb +14 -10
- data/test/test_color.rb +126 -1
- data/test/test_color_ua.rb +5 -1
- data/test/test_company.rb +7 -0
- data/test/test_company_cn.rb +24 -0
- data/test/test_company_it.rb +7 -1
- data/test/test_company_se.rb +6 -0
- data/test/test_conference.rb +5 -2
- data/test/test_course_mathematiques.rb +5 -1
- data/test/test_course_philosophie.rb +5 -1
- data/test/test_currency.rb +12 -0
- data/test/test_dizzle_ipsum.rb +12 -6
- data/test/test_education.rb +9 -2
- data/test/test_faker.rb +8 -1
- data/test/test_food.rb +11 -4
- data/test/test_gender.rb +5 -1
- data/test/test_gender_br.rb +18 -0
- data/test/test_gender_cn.rb +5 -2
- data/test/test_gender_kr.rb +7 -3
- data/test/test_geolocation.rb +11 -8
- data/test/test_guid.rb +6 -1
- data/test/test_healthcare_ipsum.rb +13 -6
- data/test/test_hipster_ipsum.rb +13 -6
- data/test/test_html_ipsum.rb +28 -20
- data/test/test_identification.rb +9 -2
- data/test/test_identification_br.rb +46 -0
- data/test/test_identification_co.rb +7 -0
- data/test/test_identification_es.rb +5 -1
- data/test/test_identification_es_cl.rb +5 -1
- data/test/test_identification_es_mx.rb +7 -2
- data/test/test_identification_kr.rb +4 -0
- data/test/test_internet.rb +36 -5
- data/test/test_internet_se.rb +12 -4
- data/test/test_job.rb +4 -0
- data/test/test_job_br.rb +17 -0
- data/test/test_job_cn.rb +4 -0
- data/test/test_job_fr.rb +4 -0
- data/test/test_job_ja.rb +4 -0
- data/test/test_job_kr.rb +4 -0
- data/test/test_job_vn.rb +22 -0
- data/test/test_locale.rb +10 -4
- data/test/test_lorem.rb +18 -11
- data/test/test_lorem_ar.rb +16 -8
- data/test/test_lorem_cn.rb +9 -2
- data/test/test_lorem_fr.rb +16 -8
- data/test/test_lorem_ja.rb +81 -0
- data/test/test_lorem_kr.rb +17 -8
- data/test/test_lorem_ua.rb +15 -8
- data/test/test_module_utils.rb +2 -2
- data/test/test_movie.rb +5 -1
- data/test/test_music.rb +11 -4
- data/test/test_name.rb +114 -1
- data/test/test_name_br.rb +41 -2
- data/test/test_name_cn.rb +7 -0
- data/test/test_name_cs.rb +7 -0
- data/test/test_name_da.rb +13 -6
- data/test/test_name_de.rb +4 -0
- data/test/test_name_fr.rb +7 -0
- data/test/test_name_ga.rb +7 -0
- data/test/test_name_gr.rb +70 -0
- data/test/test_name_it.rb +7 -0
- data/test/test_name_ja.rb +7 -0
- data/test/test_name_kh.rb +32 -0
- data/test/test_name_kr.rb +7 -0
- data/test/test_name_mx.rb +9 -0
- data/test/test_name_nb.rb +8 -0
- data/test/test_name_nl.rb +4 -0
- data/test/test_name_ph.rb +7 -0
- data/test/test_name_ru.rb +10 -3
- data/test/test_name_se.rb +12 -4
- data/test/test_name_sn.rb +8 -0
- data/test/test_name_th.rb +7 -0
- data/test/test_name_th_en.rb +35 -0
- data/test/test_name_ua.rb +26 -17
- data/test/test_name_vn.rb +42 -0
- data/test/test_nato_alphabet.rb +15 -4
- data/test/test_phone_number.rb +24 -6
- data/test/test_phone_number_au.rb +17 -6
- data/test/test_phone_number_br.rb +22 -13
- data/test/test_phone_number_cu.rb +29 -18
- data/test/test_phone_number_da.rb +16 -7
- data/test/test_phone_number_de.rb +17 -9
- data/test/test_phone_number_kr.rb +9 -0
- data/test/test_phone_number_mx.rb +16 -8
- data/test/test_phone_number_nl.rb +9 -2
- data/test/test_phone_number_se.rb +12 -7
- data/test/test_phone_number_sg.rb +17 -9
- data/test/test_phone_number_sn.rb +12 -4
- data/test/test_products.rb +22 -0
- data/test/test_skill.rb +8 -2
- data/test/test_sports.rb +4 -0
- data/test/test_ssn.rb +3 -1
- data/test/test_ssn_mx.rb +6 -1
- data/test/test_ssn_se.rb +3 -0
- data/test/test_string.rb +28 -1
- data/test/test_time.rb +33 -2
- data/test/test_tweet.rb +59 -0
- data/test/test_units.rb +7 -0
- data/test/test_units_english.rb +9 -0
- data/test/test_units_metric.rb +9 -0
- data/test/test_vehicle.rb +24 -15
- data/test/test_venue.rb +5 -1
- data/test/test_youtube.rb +28 -0
- metadata +101 -5
- data/lib/ffaker/data/name/first_names +0 -3008
- data/lib/ffaker/data/name_br/first_names +0 -91
@@ -4,6 +4,17 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Author: wiseleyb<wiseleyb@gmail.com>
|
6
6
|
class TestPhoneNumberAU < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::PhoneNumberAU,
|
11
|
+
:mobile_phone_prefix, :home_work_phone_prefix, :phone_prefix,
|
12
|
+
:mobile_phone_number, :home_work_phone_number, :phone_number,
|
13
|
+
:international_mobile_phone_number,
|
14
|
+
:international_home_work_phone_number,
|
15
|
+
:international_phone_number
|
16
|
+
)
|
17
|
+
|
7
18
|
def setup
|
8
19
|
@tester = FFaker::PhoneNumberAU
|
9
20
|
end
|
@@ -21,30 +32,30 @@ class TestPhoneNumberAU < Test::Unit::TestCase
|
|
21
32
|
end
|
22
33
|
|
23
34
|
def test_mobile_phone_number
|
24
|
-
assert_match
|
35
|
+
assert_match(/04\d{2} \d{3} \d{3}/, FFaker::PhoneNumberAU.mobile_phone_number)
|
25
36
|
end
|
26
37
|
|
27
38
|
def test_home_work_phone_number
|
28
|
-
assert_match
|
39
|
+
assert_match(/\(\d{2}\) \d{4} \d{4}/, FFaker::PhoneNumberAU.home_work_phone_number)
|
29
40
|
end
|
30
41
|
|
31
42
|
def test_phone_number
|
32
43
|
10.times do
|
33
|
-
assert_match
|
44
|
+
assert_match(/(04\d{1,2} \d{3} \d{3}|\(\d{2}\) \d{4} \d{4})/, FFaker::PhoneNumberAU.phone_number)
|
34
45
|
end
|
35
46
|
end
|
36
47
|
|
37
48
|
def test_international_mobile_phone_number
|
38
|
-
assert_match
|
49
|
+
assert_match(/\+61 \d{1,2} \d{4} \d{4}/, FFaker::PhoneNumberAU.international_mobile_phone_number)
|
39
50
|
end
|
40
51
|
|
41
52
|
def test_international_home_work_phone_number
|
42
|
-
assert_match
|
53
|
+
assert_match(/\+61 \d{1,2} \d{4} \d{4}/, FFaker::PhoneNumberAU.international_home_work_phone_number)
|
43
54
|
end
|
44
55
|
|
45
56
|
def test_international_phone_number
|
46
57
|
10.times do
|
47
|
-
assert_match
|
58
|
+
assert_match(/\+61 \d{1,2} \d{4} \d{4}/, FFaker::PhoneNumberAU.international_phone_number)
|
48
59
|
end
|
49
60
|
end
|
50
61
|
end
|
@@ -2,46 +2,55 @@
|
|
2
2
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
|
-
|
5
|
+
# Author: Gustavo Souza https://github.com/gustavor-souza
|
6
6
|
class TestPhoneNumberBR < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::PhoneNumberBR,
|
11
|
+
:phone_number, :home_work_phone_number, :mobile_phone_number,
|
12
|
+
:international_phone_number, :international_mobile_phone_number,
|
13
|
+
:international_home_work_phone_number, :country_code
|
14
|
+
)
|
15
|
+
|
7
16
|
def setup
|
8
17
|
@tester = FFaker::PhoneNumberBR
|
9
18
|
end
|
10
19
|
|
11
20
|
def test_phone_number
|
12
21
|
10.times do
|
13
|
-
assert_match
|
22
|
+
assert_match(/\A[1-9]\d\s?9?\d{4}-?\d{4}\z/, @tester.phone_number)
|
14
23
|
end
|
15
24
|
end
|
16
25
|
|
17
26
|
def test_home_work_phone_number
|
18
|
-
assert_match
|
19
|
-
|
27
|
+
assert_match(/\A[1-9]\d\s?[2-5]\d{3}-?\d{4}\z/,
|
28
|
+
@tester.home_work_phone_number)
|
20
29
|
end
|
21
30
|
|
22
31
|
def test_mobile_phone_number
|
23
|
-
assert_match
|
24
|
-
|
32
|
+
assert_match(/\A[1-9]\d\s?([6-9]|9[6-9])\d{3}-?\d{4}\z/,
|
33
|
+
@tester.mobile_phone_number)
|
25
34
|
end
|
26
35
|
|
27
36
|
def test_international_phone_number
|
28
37
|
10.times do
|
29
|
-
assert_match
|
30
|
-
|
38
|
+
assert_match(/\A\+55\s?[1-9]\d\s?9?\d{4}-?\d{4}\z/,
|
39
|
+
@tester.international_phone_number)
|
31
40
|
end
|
32
41
|
end
|
33
42
|
|
34
43
|
def test_international_mobile_phone_number
|
35
|
-
assert_match
|
36
|
-
|
44
|
+
assert_match(/\A\+55\s?[1-9]\d\s?([6-9]|9[6-9])\d{3}-?\d{4}\z/,
|
45
|
+
@tester.international_mobile_phone_number)
|
37
46
|
end
|
38
47
|
|
39
48
|
def test_international_home_work_phone_number
|
40
|
-
assert_match
|
41
|
-
|
49
|
+
assert_match(/\A\+55\s?[1-9]\d\s?[2-5]\d{3}-?\d{4}\z/,
|
50
|
+
@tester.international_home_work_phone_number)
|
42
51
|
end
|
43
52
|
|
44
53
|
def test_country_code
|
45
|
-
assert_match
|
54
|
+
assert_match('+55', @tester.country_code)
|
46
55
|
end
|
47
56
|
end
|
@@ -4,6 +4,17 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Author: Luilver<luilver@gmail.com>
|
6
6
|
class TestPhoneNumberCU < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::PhoneNumberCU,
|
11
|
+
:mobile_phone_prefix, :home_work_phone_prefix, :phone_prefix,
|
12
|
+
:mobile_phone_number, :home_work_phone_number, :general_phone_number,
|
13
|
+
:international_mobile_phone_number, :international_home_work_phone_number,
|
14
|
+
:international_phone_number,
|
15
|
+
:e164_mobile_phone_number, :e164_home_work_phone_number, :e164_phone_number
|
16
|
+
)
|
17
|
+
|
7
18
|
def setup
|
8
19
|
@tester = FFaker::PhoneNumberCU
|
9
20
|
end
|
@@ -30,57 +41,57 @@ class TestPhoneNumberCU < Test::Unit::TestCase
|
|
30
41
|
# General format test
|
31
42
|
#
|
32
43
|
def test_mobile_phone_number
|
33
|
-
assert_match
|
34
|
-
|
44
|
+
assert_match(/05 \d{3} \d{4}/,
|
45
|
+
FFaker::PhoneNumberCU.mobile_phone_number)
|
35
46
|
end
|
36
47
|
|
37
48
|
def test_home_work_phone_number
|
38
|
-
assert_match
|
39
|
-
|
49
|
+
assert_match(/\(0(7\) \d{3}|\d{2}\) \d{2}) \d{4}/,
|
50
|
+
FFaker::PhoneNumberCU.home_work_phone_number)
|
40
51
|
end
|
41
52
|
|
42
53
|
def test_general_phone_number
|
43
54
|
10.times do
|
44
|
-
assert_match
|
45
|
-
|
55
|
+
assert_match(/((05|\(07\)) \d{3}|\(0\d{2}\) \d{2}) \d{4}/,
|
56
|
+
FFaker::PhoneNumberCU.general_phone_number)
|
46
57
|
end
|
47
58
|
end
|
48
59
|
|
49
60
|
# International format tests
|
50
61
|
#
|
51
62
|
def test_international_mobile_phone_number
|
52
|
-
assert_match
|
53
|
-
|
63
|
+
assert_match(/(00|\+)535 \d{3} \d{4}/,
|
64
|
+
FFaker::PhoneNumberCU.international_mobile_phone_number)
|
54
65
|
end
|
55
66
|
|
56
67
|
def test_international_home_work_phone_number
|
57
|
-
assert_match
|
58
|
-
|
68
|
+
assert_match(/(00|\+)53(7 \d{3}|\d{2} \d{2}) \d{4}/,
|
69
|
+
FFaker::PhoneNumberCU.international_home_work_phone_number)
|
59
70
|
end
|
60
71
|
|
61
72
|
def test_international_phone_number
|
62
73
|
10.times do
|
63
|
-
assert_match
|
64
|
-
|
74
|
+
assert_match(/(00|\+)53((5|7) \d{3}|\d{2} \d{2}) \d{4}/,
|
75
|
+
FFaker::PhoneNumberCU.international_phone_number)
|
65
76
|
end
|
66
77
|
end
|
67
78
|
|
68
79
|
# E.164 format tests
|
69
80
|
#
|
70
81
|
def test_e164_mobile_phone_number
|
71
|
-
assert_match
|
72
|
-
|
82
|
+
assert_match(/535\d{7}/,
|
83
|
+
FFaker::PhoneNumberCU.e164_mobile_phone_number)
|
73
84
|
end
|
74
85
|
|
75
86
|
def test_e164_home_work_phone_number
|
76
|
-
assert_match
|
77
|
-
|
87
|
+
assert_match(/53(7\d{7}|\d{2}\d{6})/,
|
88
|
+
FFaker::PhoneNumberCU.e164_home_work_phone_number)
|
78
89
|
end
|
79
90
|
|
80
91
|
def test_e164_phone_number
|
81
92
|
10.times do
|
82
|
-
assert_match
|
83
|
-
|
93
|
+
assert_match(/53((5|7)\d{7}|\d{2}\d{6})/,
|
94
|
+
FFaker::PhoneNumberCU.e164_phone_number)
|
84
95
|
end
|
85
96
|
end
|
86
97
|
end
|
@@ -4,20 +4,30 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Author: wiseleyb<wiseleyb@gmail.com>
|
6
6
|
class TestPhoneNumberDA < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::PhoneNumberDA,
|
11
|
+
:home_work_phone_number, :mobile_phone_number, :phone_number, :country_code,
|
12
|
+
:international_mobile_phone_number,
|
13
|
+
:international_home_work_phone_number,
|
14
|
+
:international_phone_number
|
15
|
+
)
|
16
|
+
|
7
17
|
def setup
|
8
18
|
@tester = FFaker::PhoneNumberDA
|
9
19
|
end
|
10
20
|
|
11
21
|
def test_home_work_phone_number
|
12
|
-
assert_match
|
22
|
+
assert_match(/\A\d{8}\z/, @tester.home_work_phone_number)
|
13
23
|
end
|
14
24
|
|
15
25
|
def test_mobile_phone_number
|
16
|
-
assert_match
|
26
|
+
assert_match(/\A\d{8}\z/, @tester.mobile_phone_number)
|
17
27
|
end
|
18
28
|
|
19
29
|
def test_phone_number
|
20
|
-
assert_match
|
30
|
+
assert_match(/\A\d{8}\z/, @tester.phone_number)
|
21
31
|
end
|
22
32
|
|
23
33
|
def test_country_code
|
@@ -25,15 +35,14 @@ class TestPhoneNumberDA < Test::Unit::TestCase
|
|
25
35
|
end
|
26
36
|
|
27
37
|
def test_international_mobile_phone_number
|
28
|
-
assert_match
|
38
|
+
assert_match(/\A\+45 \d{8}\z/, @tester.international_mobile_phone_number)
|
29
39
|
end
|
30
40
|
|
31
41
|
def test_international_home_work_phone_number
|
32
|
-
assert_match
|
42
|
+
assert_match(/\A\+45 \d{8}\z/, @tester.international_home_work_phone_number)
|
33
43
|
end
|
34
44
|
|
35
45
|
def test_international_phone_number
|
36
|
-
assert_match
|
46
|
+
assert_match(/\A\+45 \d{8}\z/, @tester.international_phone_number)
|
37
47
|
end
|
38
|
-
|
39
48
|
end
|
@@ -4,43 +4,51 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Author: lawitschka<moritz.lawitschka@urbanvention.com>
|
6
6
|
class TestPhoneNumberDE < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::PhoneNumberDE,
|
11
|
+
:mobile_prefix, :region_prefix, :mobile_phone_number, :home_work_phone_number,
|
12
|
+
:country_code, :international_mobile_phone_number, :international_home_work_phone_number
|
13
|
+
)
|
14
|
+
|
7
15
|
def setup
|
8
16
|
@tester = FFaker::PhoneNumberDE
|
9
17
|
end
|
10
18
|
|
11
19
|
def test_mobile_prefix
|
12
|
-
assert_match
|
20
|
+
assert_match(/^01[567]{1}[0-9]{1}$/, FFaker::PhoneNumberDE.mobile_prefix)
|
13
21
|
end
|
14
22
|
|
15
23
|
def test_mobile_prefix_without_leading_zero
|
16
|
-
assert_match
|
24
|
+
assert_match(/^1[567]{1}[0-9]{1}$/, FFaker::PhoneNumberDE.mobile_prefix(false))
|
17
25
|
end
|
18
26
|
|
19
27
|
def test_region_prefix
|
20
|
-
assert_match
|
28
|
+
assert_match(/^0[2-9]{1}[0-9]{1,3}$/, FFaker::PhoneNumberDE.region_prefix)
|
21
29
|
end
|
22
30
|
|
23
31
|
def test_region_prefix_without_leading_zero
|
24
|
-
assert_match
|
32
|
+
assert_match(/^[2-9]{1}[0-9]{1,3}$/, FFaker::PhoneNumberDE.region_prefix(false))
|
25
33
|
end
|
26
34
|
|
27
35
|
def test_mobile_phone_number
|
28
|
-
assert_match
|
36
|
+
assert_match(/^01[567]{1}[0-9]{1} [0-9]{7}$/, FFaker::PhoneNumberDE.mobile_phone_number)
|
29
37
|
end
|
30
38
|
|
31
39
|
def test_home_work_phone_number
|
32
|
-
assert_match
|
40
|
+
assert_match(/^0[2-9]{1}[0-9]{1,3} [0-9]{7}$/, FFaker::PhoneNumberDE.home_work_phone_number)
|
33
41
|
end
|
34
42
|
|
35
43
|
def test_country_code
|
36
|
-
assert_match
|
44
|
+
assert_match('+49', FFaker::PhoneNumberDE.country_code)
|
37
45
|
end
|
38
46
|
|
39
47
|
def test_international_mobile_phone_number
|
40
|
-
assert_match
|
48
|
+
assert_match(/^\+49 1[567]{1}[0-9]{1} [0-9]{7}$/, FFaker::PhoneNumberDE.international_mobile_phone_number)
|
41
49
|
end
|
42
50
|
|
43
51
|
def test_international_home_work_phone_number
|
44
|
-
assert_match
|
52
|
+
assert_match(/^\+49 [2-9]{1}[0-9]{1,3} [0-9]{7}$/, FFaker::PhoneNumberDE.international_home_work_phone_number)
|
45
53
|
end
|
46
54
|
end
|
@@ -3,6 +3,15 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestPhoneNumberKR < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::PhoneNumberKR,
|
10
|
+
:mobile_phone_number, :home_work_phone_number, :phone_number,
|
11
|
+
:international_mobile_phone_number, :international_home_work_phone_number,
|
12
|
+
:international_phone_number
|
13
|
+
)
|
14
|
+
|
6
15
|
def setup
|
7
16
|
@tester = FFaker::PhoneNumberKR
|
8
17
|
end
|
@@ -4,40 +4,48 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Author: guapolo github.com/guapolo
|
6
6
|
class TestPhoneNumberMX < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::PhoneNumberMX,
|
11
|
+
:mobile_phone_number, :home_work_phone_number, :phone_number,
|
12
|
+
:international_mobile_phone_number, :international_home_work_phone_number,
|
13
|
+
:international_phone_number, :toll_free_number
|
14
|
+
)
|
15
|
+
|
7
16
|
def setup
|
8
17
|
@tester = FFaker::PhoneNumberMX
|
9
18
|
end
|
10
19
|
|
11
20
|
def test_mobile_phone_number
|
12
|
-
assert_match
|
21
|
+
assert_match(/044 \d{2} \d{4} \d{4}/, @tester.mobile_phone_number)
|
13
22
|
end
|
14
23
|
|
15
24
|
def test_home_work_phone_number
|
16
|
-
assert_match
|
25
|
+
assert_match(/\d{2} \d{4} \d{4}/, @tester.home_work_phone_number)
|
17
26
|
end
|
18
27
|
|
19
28
|
def test_phone_number
|
20
29
|
10.times do
|
21
|
-
assert_match
|
30
|
+
assert_match(/(044 )*\d{2} \d{4} \d{4}/, @tester.phone_number)
|
22
31
|
end
|
23
32
|
end
|
24
33
|
|
25
34
|
def test_international_mobile_phone_number
|
26
|
-
assert_match
|
35
|
+
assert_match(/\+52 1 \d{2} \d{4} \d{4}/, @tester.international_mobile_phone_number)
|
27
36
|
end
|
28
37
|
|
29
38
|
def test_international_home_work_phone_number
|
30
|
-
assert_match
|
39
|
+
assert_match(/\+52 \d{2} \d{4} \d{4}/, @tester.international_home_work_phone_number)
|
31
40
|
end
|
32
41
|
|
33
42
|
def test_international_phone_number
|
34
43
|
10.times do
|
35
|
-
assert_match
|
44
|
+
assert_match(/\+52 (\d )*\d{2} \d{4} \d{4}/, @tester.international_phone_number)
|
36
45
|
end
|
37
46
|
end
|
38
47
|
|
39
48
|
def test_toll_free_phone_number
|
40
|
-
assert_match
|
49
|
+
assert_match(/01 800 \d{3} \d{4}/, @tester.toll_free_number)
|
41
50
|
end
|
42
51
|
end
|
43
|
-
|
@@ -4,6 +4,13 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Author: wiseleyb<wiseleyb@gmail.com>
|
6
6
|
class TestPhoneNumberNL < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::PhoneNumberNL,
|
11
|
+
:mobile_phone_number, :phone_number, :international_phone_number
|
12
|
+
)
|
13
|
+
|
7
14
|
def setup
|
8
15
|
@tester = FFaker::PhoneNumberNL
|
9
16
|
end
|
@@ -18,13 +25,13 @@ class TestPhoneNumberNL < Test::Unit::TestCase
|
|
18
25
|
|
19
26
|
def test_phone_number
|
20
27
|
10.times do
|
21
|
-
assert_match
|
28
|
+
assert_match(/^0([\s\-]*\d){9}$/, @tester.phone_number)
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_international_phone_number
|
26
33
|
10.times do
|
27
|
-
assert_match
|
34
|
+
assert_match(/^\+31/, @tester.international_phone_number)
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
@@ -3,6 +3,14 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestPhoneNumberSE < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::PhoneNumberSE,
|
10
|
+
:mobile_prefix, :area_prefix, :country_prefix, :mobile_phone_number,
|
11
|
+
:home_work_phone_number, :phone_number, :international_mobile_phone_number,
|
12
|
+
:international_home_work_phone_number, :international_phone_number
|
13
|
+
)
|
6
14
|
|
7
15
|
def setup
|
8
16
|
@tester = FFaker::PhoneNumberSE
|
@@ -23,20 +31,20 @@ class TestPhoneNumberSE < Test::Unit::TestCase
|
|
23
31
|
end
|
24
32
|
|
25
33
|
def test_mobile_phone_number
|
26
|
-
assert_match
|
34
|
+
assert_match(ALLOWED_CHARS, FFaker::PhoneNumberSE.mobile_phone_number)
|
27
35
|
assert_match(/\d{3}/, FFaker::PhoneNumberSE.mobile_phone_number)
|
28
36
|
assert FFaker::PhoneNumberSE.mobile_phone_number.length > 9
|
29
37
|
end
|
30
38
|
|
31
39
|
def test_home_work_phone_number
|
32
|
-
assert_match
|
40
|
+
assert_match(ALLOWED_CHARS, FFaker::PhoneNumberSE.home_work_phone_number)
|
33
41
|
assert_match(/\d{1} \d{2}/, FFaker::PhoneNumberSE.home_work_phone_number)
|
34
42
|
assert FFaker::PhoneNumberSE.mobile_phone_number.length > 9
|
35
43
|
end
|
36
44
|
|
37
45
|
def test_phone_number
|
38
46
|
10.times do
|
39
|
-
assert_match
|
47
|
+
assert_match(ALLOWED_CHARS, FFaker::PhoneNumberSE.phone_number)
|
40
48
|
end
|
41
49
|
end
|
42
50
|
|
@@ -50,11 +58,8 @@ class TestPhoneNumberSE < Test::Unit::TestCase
|
|
50
58
|
|
51
59
|
def test_international_phone_number
|
52
60
|
10.times do
|
53
|
-
assert_match
|
61
|
+
assert_match(ALLOWED_CHARS, FFaker::PhoneNumberSE.international_phone_number)
|
54
62
|
assert_match(/46/, FFaker::PhoneNumberSE.international_phone_number)
|
55
63
|
end
|
56
64
|
end
|
57
|
-
|
58
65
|
end
|
59
|
-
|
60
|
-
|