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
data/test/test_address_fi.rb
CHANGED
@@ -4,11 +4,18 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Test features related to Finnish addresses
|
6
6
|
class TestAddressFI < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
7
9
|
ALPHA = /\A[\p{Alpha}]+/
|
8
10
|
DIGIT = /\d{1}/
|
9
11
|
|
12
|
+
assert_methods_are_deterministic(
|
13
|
+
FFaker::AddressFI,
|
14
|
+
:city, :full_address, :random_country, :zip_code
|
15
|
+
)
|
16
|
+
|
10
17
|
def test_fi_city
|
11
|
-
assert_match
|
18
|
+
assert_match(ALPHA, FFaker::AddressFI.city)
|
12
19
|
end
|
13
20
|
|
14
21
|
def test_fi_zip_code
|
@@ -21,8 +28,8 @@ class TestAddressFI < Test::Unit::TestCase
|
|
21
28
|
|
22
29
|
def test_fi_full_address
|
23
30
|
address = FFaker::AddressFI.full_address
|
24
|
-
assert_match
|
25
|
-
assert_match
|
31
|
+
assert_match(ALPHA, address)
|
32
|
+
assert_match(DIGIT, address)
|
26
33
|
assert_match(/SUOMI/, address)
|
27
34
|
assert_match(/[\, a-z]/, address)
|
28
35
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
# Test features related to Finnish addresses
|
6
|
+
class TestAddressFR < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::AddressFR,
|
11
|
+
:city, :full_address, :street_name, :postal_code
|
12
|
+
)
|
13
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
class TestAddressGR < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressGR,
|
10
|
+
:city, :region, :zip_code, :street_name, :street_nbr, :street_address
|
11
|
+
)
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@address_gr = FFaker::AddressGR
|
15
|
+
@street_prefix = FFaker::AddressGR::STREET_PREFIX.join("|")
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_city
|
19
|
+
assert_match /\p{Greek}/, @address_gr.city
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_region
|
23
|
+
assert_match /\p{Greek}/, @address_gr.region
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_zip_code
|
27
|
+
assert_match /\A\d{5}\z/, @address_gr.zip_code
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_street_name
|
31
|
+
assert_match /\p{Greek}/, @address_gr.street_name
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_street_nbr
|
35
|
+
assert_match /\A\d{1,3}\z/, @address_gr.street_nbr
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_street_address
|
39
|
+
address = FFaker::AddressGR.street_address
|
40
|
+
assert_match(/#{@street_prefix}/, address)
|
41
|
+
assert_match(/\p{Greek}/, address)
|
42
|
+
end
|
43
|
+
end
|
data/test/test_address_in.rb
CHANGED
@@ -3,48 +3,56 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestAddressININ < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressIN,
|
10
|
+
:country_code, :country, :pincode, :state_abbr,
|
11
|
+
:state_and_union_territory_abbr, :state_and_union_territory, :state,
|
12
|
+
:time_zone, :union_territory_abbr, :union_territory
|
13
|
+
)
|
14
|
+
|
6
15
|
def test_in_state
|
7
|
-
assert_match
|
16
|
+
assert_match(/\A[A-Z][ A-Za-z]*\z/, FFaker::AddressIN.state)
|
8
17
|
end
|
9
18
|
|
10
19
|
def test_in_state_abbr
|
11
|
-
assert_match
|
20
|
+
assert_match(/\A[A-Z]{2}\z/, FFaker::AddressIN.state_abbr)
|
12
21
|
end
|
13
22
|
|
14
23
|
def test_in_union_territory
|
15
|
-
assert_match
|
24
|
+
assert_match(/\A[A-Z][ A-Za-z]*\z/, FFaker::AddressIN.union_territory)
|
16
25
|
end
|
17
26
|
|
18
27
|
def test_in_union_territory_abbr
|
19
|
-
assert_match
|
28
|
+
assert_match(/\A[A-Z]{2}\z/, FFaker::AddressIN.union_territory_abbr)
|
20
29
|
end
|
21
30
|
|
22
31
|
def test_in_state_and_union_territory
|
23
|
-
assert_match
|
32
|
+
assert_match(/\A[A-Z][ A-Za-z]*\z/, FFaker::AddressIN.state_and_union_territory)
|
24
33
|
end
|
25
34
|
|
26
35
|
def test_in_state_and_union_territory_abbr
|
27
|
-
assert_match
|
36
|
+
assert_match(/\A[A-Z]{2}\z/, FFaker::AddressIN.state_and_union_territory_abbr)
|
28
37
|
end
|
29
38
|
|
30
39
|
def test_pincode
|
31
|
-
assert_match
|
40
|
+
assert_match(/[0-9]{6}/, FFaker::AddressIN.pincode)
|
32
41
|
end
|
33
42
|
|
34
43
|
def test_zip_code
|
35
|
-
assert_match
|
44
|
+
assert_match(/[0-9]{6}/, FFaker::AddressIN.pincode)
|
36
45
|
end
|
37
46
|
|
38
47
|
def test_in_country
|
39
|
-
assert_equal
|
48
|
+
assert_equal 'India', FFaker::AddressIN.country
|
40
49
|
end
|
41
50
|
|
42
51
|
def test_in_country_code
|
43
|
-
assert_equal
|
52
|
+
assert_equal 'IN', FFaker::AddressIN.country_code
|
44
53
|
end
|
45
54
|
|
46
55
|
def test_in_time_zone
|
47
|
-
assert_equal
|
56
|
+
assert_equal 'Asia/Kolkata', FFaker::AddressIN.time_zone
|
48
57
|
end
|
49
|
-
|
50
58
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
class TestAddressKR < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressKR,
|
10
|
+
:postal_code, :old_postal_code, :road_addess, :land_address, :land_number,
|
11
|
+
:building_name, :address_detail, :street, :town, :borough, :city, :province,
|
12
|
+
:metropolitan_city
|
13
|
+
)
|
14
|
+
end
|
data/test/test_address_mx.rb
CHANGED
@@ -4,23 +4,30 @@ require 'helper'
|
|
4
4
|
|
5
5
|
# Author: guapolo github.com/guapolo
|
6
6
|
class TestAddressMX < Test::Unit::TestCase
|
7
|
+
include DeterministicHelper
|
8
|
+
|
9
|
+
assert_methods_are_deterministic(
|
10
|
+
FFaker::AddressMX,
|
11
|
+
:municipality, :postal_code, :state_abbr, :state, :zip_code
|
12
|
+
)
|
13
|
+
|
7
14
|
def test_mx_state
|
8
|
-
assert_match
|
15
|
+
assert_match(/[\sa-z]/i, FFaker::AddressMX.state)
|
9
16
|
end
|
10
17
|
|
11
18
|
def test_mx_state_abbr
|
12
|
-
assert_match
|
19
|
+
assert_match(/[A-Z]/, FFaker::AddressMX.state_abbr)
|
13
20
|
end
|
14
21
|
|
15
22
|
def test_postal_code
|
16
|
-
assert_match
|
23
|
+
assert_match(/[0-9]/, FFaker::AddressMX.postal_code)
|
17
24
|
end
|
18
25
|
|
19
26
|
def test_zip_code
|
20
|
-
assert_match
|
27
|
+
assert_match(/[0-9]/, FFaker::AddressMX.zip_code)
|
21
28
|
end
|
22
29
|
|
23
30
|
def test_mx_municipality
|
24
|
-
assert_match
|
31
|
+
assert_match(/[\sa-z]/i, FFaker::AddressMX.municipality)
|
25
32
|
end
|
26
33
|
end
|
data/test/test_address_nl.rb
CHANGED
@@ -3,28 +3,34 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestAddressNL < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressNL,
|
10
|
+
:city, :province, :street_address, :street_name, :zip_code
|
11
|
+
)
|
6
12
|
|
7
13
|
def setup
|
8
14
|
@tester = FFaker::AddressNL
|
9
15
|
end
|
10
16
|
|
11
17
|
def test_city
|
12
|
-
assert_match
|
18
|
+
assert_match(/[ a-z]+/, @tester.city)
|
13
19
|
end
|
14
20
|
|
15
21
|
def test_province
|
16
|
-
assert_match
|
22
|
+
assert_match(/[ a-z]/, @tester.province)
|
17
23
|
end
|
18
24
|
|
19
25
|
def test_zip_code
|
20
|
-
assert_match
|
26
|
+
assert_match(/^\d{4}\s\w{2}$/, @tester.zip_code)
|
21
27
|
end
|
22
28
|
|
23
29
|
def test_street_name
|
24
|
-
assert_match
|
30
|
+
assert_match(/[ a-z]+/, @tester.street_name)
|
25
31
|
end
|
26
32
|
|
27
33
|
def test_street_address
|
28
|
-
assert_match
|
34
|
+
assert_match(/[ a-z]+/, @tester.street_address)
|
29
35
|
end
|
30
36
|
end
|
data/test/test_address_ru.rb
CHANGED
@@ -3,28 +3,34 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestAddressRU < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressRU,
|
10
|
+
:city, :province, :street_address, :street_name, :zip_code
|
11
|
+
)
|
6
12
|
|
7
13
|
def setup
|
8
14
|
@tester = FFaker::AddressRU
|
9
15
|
end
|
10
16
|
|
11
17
|
def test_city
|
12
|
-
assert_match
|
18
|
+
assert_match(/\A[a-zа-яё\-\s]+\z/i, @tester.city)
|
13
19
|
end
|
14
20
|
|
15
21
|
def test_province
|
16
|
-
assert_match
|
22
|
+
assert_match(/\A[a-zа-яё\-\s]+\z/i, @tester.province)
|
17
23
|
end
|
18
24
|
|
19
25
|
def test_zip_code
|
20
|
-
assert_match
|
26
|
+
assert_match(/\A\d{6}\z/, @tester.zip_code)
|
21
27
|
end
|
22
28
|
|
23
29
|
def test_street_name
|
24
|
-
assert_match
|
30
|
+
assert_match(/\A[a-zа-яё.\-\s]+\z/i, @tester.street_name)
|
25
31
|
end
|
26
32
|
|
27
33
|
def test_street_address
|
28
|
-
assert_match
|
34
|
+
assert_match(/\A[a-zа-яё.,\-\s\d]+\z/i, @tester.street_address)
|
29
35
|
end
|
30
36
|
end
|
data/test/test_address_se.rb
CHANGED
@@ -3,12 +3,18 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestAddressSE < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
6
7
|
|
7
8
|
ALPHA = /\A[\p{Alpha}]+/
|
8
9
|
DIGIT = /\d{1}/
|
9
10
|
|
11
|
+
assert_methods_are_deterministic(
|
12
|
+
FFaker::AddressSE,
|
13
|
+
:city, :random_country, :full_address, :zip_code
|
14
|
+
)
|
15
|
+
|
10
16
|
def test_se_city
|
11
|
-
assert_match
|
17
|
+
assert_match(ALPHA, FFaker::AddressSE.city)
|
12
18
|
end
|
13
19
|
|
14
20
|
def test_se_zip_code
|
@@ -21,8 +27,8 @@ class TestAddressSE < Test::Unit::TestCase
|
|
21
27
|
|
22
28
|
def test_se_full_address
|
23
29
|
address = FFaker::AddressSE.full_address
|
24
|
-
assert_match
|
25
|
-
assert_match
|
30
|
+
assert_match(ALPHA, address)
|
31
|
+
assert_match(DIGIT, address)
|
26
32
|
assert_match(/SVERIGE/, address)
|
27
33
|
assert_match(/[\, a-z]/, address)
|
28
34
|
end
|
data/test/test_address_sn.rb
CHANGED
@@ -3,9 +3,15 @@
|
|
3
3
|
# => author: PapePathe github.com/PapePathe
|
4
4
|
# => email: pathe.sene@gmail.com
|
5
5
|
|
6
|
-
require
|
6
|
+
require 'helper'
|
7
7
|
|
8
8
|
class TestAddressSn < Test::Unit::TestCase
|
9
|
+
include DeterministicHelper
|
10
|
+
|
11
|
+
assert_methods_are_deterministic(
|
12
|
+
FFaker::AddressSN,
|
13
|
+
:region, :departement, :arrondissement
|
14
|
+
)
|
9
15
|
|
10
16
|
def setup
|
11
17
|
@subject = FFaker::AddressSN
|
data/test/test_address_ua.rb
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestAddressUA < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressUA,
|
10
|
+
:city, :country, :province, :zip_code, :street_name, :street_address,
|
11
|
+
:building_number, :appartment_number
|
12
|
+
)
|
6
13
|
|
7
14
|
def setup
|
8
15
|
@tester = FFaker::AddressUA
|
@@ -10,40 +17,40 @@ class TestAddressUA < Test::Unit::TestCase
|
|
10
17
|
end
|
11
18
|
|
12
19
|
def test_city
|
13
|
-
assert_match
|
20
|
+
assert_match(@multiple_words_name_regexp, @tester.city)
|
14
21
|
end
|
15
22
|
|
16
23
|
def test_country
|
17
|
-
assert_match
|
24
|
+
assert_match(@multiple_words_name_regexp, @tester.country)
|
18
25
|
end
|
19
26
|
|
20
27
|
def test_province
|
21
|
-
assert_match
|
28
|
+
assert_match(@multiple_words_name_regexp, @tester.province)
|
22
29
|
end
|
23
30
|
|
24
31
|
def test_zip_code
|
25
|
-
assert_match
|
32
|
+
assert_match(/\A\d{5}\z/, @tester.zip_code)
|
26
33
|
end
|
27
34
|
|
28
35
|
def test_street_name
|
29
|
-
assert_match
|
36
|
+
assert_match(/\Aвул\.\s[а-яА-ЯіїєґІЇЄҐ’\-\s]+\z/, @tester.street_name)
|
30
37
|
end
|
31
38
|
|
32
39
|
def test_street_address
|
33
|
-
assert_match
|
40
|
+
assert_match(/\Aвул\.\s[а-яА-ЯіїєґІЇЄҐ’\-\s]+,\s\d{1,3}\z/, @tester.street_address)
|
34
41
|
end
|
35
42
|
|
36
43
|
def test_street_address_with_secondary
|
37
|
-
assert_match \
|
44
|
+
assert_match( \
|
38
45
|
/\Aвул\.\s[а-яА-ЯіїєґІЇЄҐ’\-\s]+,\s\d{1,3},\sкв\.\s\d{1,3}\z/,
|
39
|
-
@tester.street_address(true)
|
46
|
+
@tester.street_address(true))
|
40
47
|
end
|
41
48
|
|
42
49
|
def test_building_number
|
43
|
-
assert_match
|
50
|
+
assert_match(/\A\d{1,3}\z/, @tester.building_number)
|
44
51
|
end
|
45
52
|
|
46
53
|
def test_appartment_number
|
47
|
-
assert_match
|
54
|
+
assert_match(/\A\d{1,3}\z/, @tester.appartment_number)
|
48
55
|
end
|
49
56
|
end
|
data/test/test_address_uk.rb
CHANGED
@@ -3,15 +3,23 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestAddressUK < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressUK,
|
10
|
+
:country, :county, :postcode
|
11
|
+
)
|
12
|
+
|
6
13
|
def test_county
|
7
|
-
assert_match
|
14
|
+
assert_match(/[ a-z]/, FFaker::AddressUK.county)
|
8
15
|
end
|
9
16
|
|
10
17
|
def test_country
|
11
|
-
assert_match
|
18
|
+
assert_match(/[ a-z]/, FFaker::AddressUK.country)
|
12
19
|
end
|
13
20
|
|
14
21
|
def test_postcode
|
15
|
-
assert_match
|
22
|
+
assert_match(/^[A-Z]{2}\d \d[A-Z]{2}|[A-Z]{2}\d\d \d[A-Z]{2}$/,
|
23
|
+
FFaker::AddressUK.postcode)
|
16
24
|
end
|
17
25
|
end
|
data/test/test_address_us.rb
CHANGED
@@ -3,28 +3,37 @@
|
|
3
3
|
require 'helper'
|
4
4
|
|
5
5
|
class TestAddressUSUS < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::AddressUS,
|
10
|
+
:continental_state_abbr, :continental_state,
|
11
|
+
:state_abbr, :state_and_territories_abbr, :state,
|
12
|
+
:zip_code
|
13
|
+
)
|
14
|
+
|
6
15
|
def test_us_state
|
7
|
-
assert_match
|
16
|
+
assert_match(/[ a-z]/, FFaker::AddressUS.state)
|
8
17
|
end
|
9
18
|
|
10
19
|
def test_us_state_abbr
|
11
|
-
assert_match
|
20
|
+
assert_match(/[A-Z]/, FFaker::AddressUS.state_abbr)
|
12
21
|
end
|
13
22
|
|
14
23
|
def test_us_state_and_territories_abbr
|
15
|
-
assert_match
|
24
|
+
assert_match(/[A-Z]/, FFaker::AddressUS.state_and_territories_abbr)
|
16
25
|
end
|
17
26
|
|
18
27
|
def test_us_continental_state
|
19
|
-
assert_match
|
28
|
+
assert_match(/[ a-z]/, FFaker::AddressUS.continental_state)
|
20
29
|
end
|
21
30
|
|
22
31
|
def test_us_continental_state_abbr
|
23
|
-
assert_match
|
32
|
+
assert_match(/[A-Z]/, FFaker::AddressUS.continental_state_abbr)
|
24
33
|
end
|
25
34
|
|
26
35
|
def test_zip_code
|
27
|
-
assert_match
|
36
|
+
assert_match(/[0-9]/, FFaker::AddressUS.zip_code)
|
28
37
|
end
|
29
38
|
|
30
39
|
def test_zip_code_frozen
|