ffaker 2.16.0 → 2.20.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 +32 -0
- data/README.md +6 -4
- data/REFERENCE.md +1484 -1257
- data/Rakefile +3 -3
- data/ffaker.gemspec +4 -7
- data/lib/ffaker/address_au.rb +1 -1
- data/lib/ffaker/address_br.rb +1 -1
- data/lib/ffaker/address_ca.rb +1 -1
- data/lib/ffaker/address_ch.rb +0 -2
- data/lib/ffaker/address_ch_de.rb +0 -2
- data/lib/ffaker/address_ch_fr.rb +0 -2
- data/lib/ffaker/address_ch_it.rb +0 -2
- data/lib/ffaker/address_da.rb +0 -2
- data/lib/ffaker/address_de.rb +0 -2
- data/lib/ffaker/address_fi.rb +0 -2
- data/lib/ffaker/address_fr.rb +0 -2
- data/lib/ffaker/address_gr.rb +0 -2
- data/lib/ffaker/address_id.rb +0 -2
- data/lib/ffaker/address_in.rb +0 -2
- data/lib/ffaker/address_it.rb +37 -0
- data/lib/ffaker/address_ja.rb +0 -2
- data/lib/ffaker/address_mx.rb +2 -8
- data/lib/ffaker/address_nl.rb +0 -2
- data/lib/ffaker/address_ru.rb +0 -2
- data/lib/ffaker/address_se.rb +0 -2
- data/lib/ffaker/address_sn.rb +0 -2
- data/lib/ffaker/address_ua.rb +0 -2
- data/lib/ffaker/address_uk.rb +0 -2
- data/lib/ffaker/address_us.rb +0 -2
- data/lib/ffaker/animal.rb +1 -1
- data/lib/ffaker/bacon_ipsum.rb +0 -2
- data/lib/ffaker/company_fr.rb +35 -0
- data/lib/ffaker/{courses.rb → courses_fr.rb} +2 -0
- data/lib/ffaker/data/address_br/city +0 -1
- data/lib/ffaker/data/address_br/state +1 -1
- data/lib/ffaker/data/address_it/city +111 -0
- data/lib/ffaker/data/address_it/region +20 -0
- data/lib/ffaker/data/filesystem/extension +31 -31
- data/lib/ffaker/data/food_pl/diary +14 -0
- data/lib/ffaker/data/food_pl/fermented +13 -0
- data/lib/ffaker/data/food_pl/fruits +34 -0
- data/lib/ffaker/data/food_pl/herbs +20 -0
- data/lib/ffaker/data/food_pl/meats +9 -0
- data/lib/ffaker/data/food_pl/preserves +10 -0
- data/lib/ffaker/data/food_pl/spices +26 -0
- data/lib/ffaker/data/food_pl/vegetables +45 -0
- data/lib/ffaker/data/freedom_ipsum/freedom_words +161 -0
- data/lib/ffaker/data/game/adj_and_adv +18 -0
- data/lib/ffaker/data/game/category +84 -0
- data/lib/ffaker/data/game/mechanic +182 -0
- data/lib/ffaker/data/game/nouns +37 -0
- data/lib/ffaker/data/game/prefixes +17 -0
- data/lib/ffaker/data/job_it/job_adj +37 -0
- data/lib/ffaker/data/job_it/job_noun +25 -0
- data/lib/ffaker/data/job_it/job_prefix +22 -0
- data/lib/ffaker/data/lorem/words +0 -67
- data/lib/ffaker/data/lorem_br/characters +36 -0
- data/lib/ffaker/data/lorem_br/words +183 -0
- data/lib/ffaker/data/lorem_it/words +321 -0
- data/lib/ffaker/data/name/pronouns +1 -1
- data/lib/ffaker/data/name_ga/first_names_male +286 -286
- data/lib/ffaker/data/phone_number_ja/four_disit_area_codes +41 -0
- data/lib/ffaker/data/phone_number_ja/one_disit_area_codes +3 -0
- data/lib/ffaker/data/phone_number_ja/three_disit_area_codes +296 -0
- data/lib/ffaker/data/phone_number_ja/two_disit_area_codes +48 -0
- data/lib/ffaker/data/sport_ru/summer +68 -0
- data/lib/ffaker/data/sport_ru/winter +20 -0
- data/lib/ffaker/dizzle_ipsum.rb +0 -2
- data/lib/ffaker/filesystem.rb +7 -7
- data/lib/ffaker/food_pl.rb +65 -0
- data/lib/ffaker/freedom_ipsum.rb +20 -0
- data/lib/ffaker/game.rb +33 -0
- data/lib/ffaker/gender_it.rb +17 -0
- data/lib/ffaker/gender_ru.rb +22 -0
- data/lib/ffaker/healthcare_ipsum.rb +0 -2
- data/lib/ffaker/hipster_ipsum.rb +0 -2
- data/lib/ffaker/identification_es_cl.rb +0 -2
- data/lib/ffaker/identification_es_co.rb +0 -1
- data/lib/ffaker/identification_it.rb +30 -0
- data/lib/ffaker/identification_kr.rb +1 -1
- data/lib/ffaker/identification_mx.rb +1 -3
- data/lib/ffaker/image.rb +8 -11
- data/lib/ffaker/internet.rb +1 -1
- data/lib/ffaker/internet_se.rb +1 -3
- data/lib/ffaker/job_it.rb +12 -0
- data/lib/ffaker/lorem_br.rb +45 -0
- data/lib/ffaker/lorem_cn.rb +0 -1
- data/lib/ffaker/lorem_it.rb +39 -0
- data/lib/ffaker/name_cs.rb +0 -2
- data/lib/ffaker/name_da.rb +0 -2
- data/lib/ffaker/name_de.rb +0 -2
- data/lib/ffaker/name_mx.rb +0 -2
- data/lib/ffaker/name_nb.rb +0 -2
- data/lib/ffaker/name_nl.rb +0 -2
- data/lib/ffaker/name_ph.rb +0 -2
- data/lib/ffaker/name_ru.rb +0 -2
- data/lib/ffaker/name_se.rb +0 -2
- data/lib/ffaker/name_th_en.rb +1 -1
- data/lib/ffaker/name_ua.rb +0 -2
- data/lib/ffaker/number.rb +26 -0
- data/lib/ffaker/phone_number_br.rb +2 -2
- data/lib/ffaker/phone_number_da.rb +0 -1
- data/lib/ffaker/phone_number_it.rb +8 -6
- data/lib/ffaker/phone_number_ja.rb +88 -0
- data/lib/ffaker/sport_ru.rb +25 -0
- data/lib/ffaker/ssn.rb +1 -3
- data/lib/ffaker/ssn_se.rb +0 -19
- data/lib/ffaker/string.rb +4 -4
- data/lib/ffaker/unit.rb +9 -10
- data/lib/ffaker/unit_english.rb +18 -21
- data/lib/ffaker/unit_metric.rb +15 -18
- data/lib/ffaker/utils/array_utils.rb +1 -1
- data/lib/ffaker/utils/module_utils.rb +23 -3
- data/lib/ffaker/vehicle.rb +1 -1
- data/lib/ffaker.rb +19 -4
- data/lib/version.rb +1 -1
- data/scripts/profiling.rb +1 -1
- data/scripts/reference.rb +2 -3
- data/test/helper.rb +4 -4
- data/test/test_address.rb +1 -1
- data/test/test_address_au.rb +3 -3
- data/test/test_address_br.rb +2 -2
- data/test/test_address_ca.rb +1 -1
- data/test/test_address_ch.rb +1 -1
- data/test/test_address_ch_de.rb +1 -1
- data/test/test_address_ch_fr.rb +1 -1
- data/test/test_address_ch_it.rb +1 -1
- data/test/test_address_da.rb +1 -1
- data/test/test_address_de.rb +1 -1
- data/test/test_address_fi.rb +3 -3
- data/test/test_address_fr.rb +1 -1
- data/test/test_address_gr.rb +1 -1
- data/test/test_address_id.rb +2 -2
- data/test/test_address_in.rb +1 -1
- data/test/test_address_it.rb +12 -0
- data/test/test_address_ja.rb +2 -2
- data/test/test_address_kr.rb +1 -1
- data/test/test_address_mx.rb +1 -1
- data/test/test_address_nl.rb +1 -1
- data/test/test_address_pl.rb +1 -1
- data/test/test_address_ru.rb +1 -1
- data/test/test_address_se.rb +3 -3
- data/test/test_address_sn.rb +1 -1
- data/test/test_address_ua.rb +1 -1
- data/test/test_address_uk.rb +1 -1
- data/test/test_address_us.rb +1 -1
- data/test/test_airline.rb +1 -1
- data/test/test_animal.rb +1 -1
- data/test/test_animal_cn.rb +1 -1
- data/test/test_animal_es.rb +1 -1
- data/test/test_animal_pl.rb +1 -1
- data/test/test_animal_us.rb +1 -1
- data/test/test_array_utils.rb +2 -1
- data/test/test_avatar.rb +1 -1
- data/test/test_aws.rb +2 -2
- data/test/test_bacon_ipsum.rb +1 -1
- data/test/test_bank.rb +3 -4
- data/test/test_book.rb +5 -5
- data/test/test_boolean.rb +1 -1
- data/test/test_cheesy_lingo.rb +1 -1
- data/test/test_code.rb +1 -1
- data/test/test_color.rb +1 -1
- data/test/test_color_pl.rb +1 -1
- data/test/test_color_ua.rb +1 -1
- data/test/test_company.rb +1 -1
- data/test/test_company_cn.rb +1 -1
- data/test/test_company_fr.rb +33 -0
- data/test/test_company_it.rb +1 -1
- data/test/test_company_ja.rb +1 -1
- data/test/test_company_se.rb +1 -1
- data/test/test_conference.rb +1 -1
- data/test/test_course_mathematiques.rb +1 -1
- data/test/test_course_philosophie.rb +1 -1
- data/test/test_currency.rb +1 -1
- data/test/test_dizzle_ipsum.rb +1 -1
- data/test/test_education.rb +1 -1
- data/test/test_education_cn.rb +1 -1
- data/test/{test_faker.rb → test_ffaker.rb} +6 -2
- data/test/test_filesystem.rb +12 -4
- data/test/test_food.rb +1 -1
- data/test/test_food_pl.rb +61 -0
- data/test/test_freedom_ipsum.rb +21 -0
- data/test/test_game.rb +28 -0
- data/test/test_gender.rb +2 -2
- data/test/test_gender_br.rb +1 -1
- data/test/test_gender_cn.rb +1 -1
- data/test/test_gender_id.rb +1 -1
- data/test/test_gender_it.rb +27 -0
- data/test/test_gender_ja.rb +1 -1
- data/test/test_gender_jp.rb +1 -1
- data/test/test_gender_kr.rb +1 -1
- data/test/test_gender_pl.rb +1 -1
- data/test/test_gender_ru.rb +23 -0
- data/test/test_geolocation.rb +1 -1
- data/test/test_guid.rb +1 -1
- data/test/test_healthcare_ipsum.rb +1 -1
- data/test/test_healthcare_ru.rb +2 -2
- data/test/test_hipster_ipsum.rb +1 -1
- data/test/test_html_ipsum.rb +2 -2
- data/test/test_identification.rb +1 -1
- data/test/test_identification_br.rb +1 -1
- data/test/test_identification_co.rb +2 -2
- data/test/test_identification_es.rb +1 -1
- data/test/test_identification_es_cl.rb +2 -2
- data/test/test_identification_es_mx.rb +1 -1
- data/test/test_identification_in.rb +1 -1
- data/test/test_identification_it.rb +34 -0
- data/test/test_identification_kr.rb +1 -1
- data/test/test_identification_tw.rb +1 -1
- data/test/test_image.rb +5 -5
- data/test/test_internet.rb +1 -1
- data/test/test_internet_se.rb +2 -2
- data/test/test_job.rb +1 -1
- data/test/test_job_br.rb +1 -1
- data/test/test_job_cn.rb +1 -1
- data/test/test_job_fr.rb +1 -1
- data/test/test_job_it.rb +17 -0
- data/test/test_job_ja.rb +1 -1
- data/test/test_job_kr.rb +1 -1
- data/test/test_job_vn.rb +1 -1
- data/test/test_locale.rb +1 -1
- data/test/test_lorem.rb +5 -1
- data/test/test_lorem_ar.rb +1 -1
- data/test/test_lorem_br.rb +62 -0
- data/test/test_lorem_cn.rb +1 -1
- data/test/test_lorem_fr.rb +10 -8
- data/test/test_lorem_ie.rb +1 -1
- data/test/test_lorem_it.rb +51 -0
- data/test/test_lorem_ja.rb +1 -1
- data/test/test_lorem_kr.rb +1 -1
- data/test/test_lorem_pl.rb +2 -2
- data/test/test_lorem_ru.rb +2 -2
- data/test/test_lorem_ua.rb +2 -2
- data/test/test_module_utils.rb +1 -1
- data/test/test_movie.rb +1 -1
- data/test/test_music.rb +5 -5
- data/test/test_name.rb +1 -1
- data/test/test_name_ar.rb +1 -1
- data/test/test_name_br.rb +1 -1
- data/test/test_name_cn.rb +1 -1
- data/test/test_name_cs.rb +1 -1
- data/test/test_name_da.rb +1 -1
- data/test/test_name_de.rb +1 -1
- data/test/test_name_es.rb +1 -1
- data/test/test_name_fr.rb +1 -1
- data/test/test_name_ga.rb +1 -1
- data/test/test_name_gr.rb +1 -1
- data/test/test_name_id.rb +1 -1
- data/test/test_name_it.rb +1 -1
- data/test/test_name_ja.rb +1 -1
- data/test/test_name_kh.rb +1 -1
- data/test/test_name_kr.rb +1 -1
- data/test/test_name_mx.rb +1 -1
- data/test/test_name_nb.rb +1 -1
- data/test/test_name_nl.rb +1 -1
- data/test/test_name_ph.rb +1 -1
- data/test/test_name_pl.rb +1 -1
- data/test/test_name_ru.rb +1 -1
- data/test/test_name_se.rb +1 -1
- data/test/test_name_sn.rb +1 -1
- data/test/test_name_th.rb +1 -1
- data/test/test_name_th_en.rb +1 -1
- data/test/test_name_tw.rb +1 -1
- data/test/test_name_ua.rb +1 -1
- data/test/test_name_vn.rb +1 -1
- data/test/test_nato_alphabet.rb +1 -1
- data/test/test_number.rb +45 -0
- data/test/test_phone_number.rb +1 -1
- data/test/test_phone_number_au.rb +1 -1
- data/test/test_phone_number_br.rb +1 -1
- data/test/test_phone_number_cu.rb +1 -1
- data/test/test_phone_number_da.rb +1 -1
- data/test/test_phone_number_de.rb +1 -1
- data/test/test_phone_number_fr.rb +1 -1
- data/test/test_phone_number_id.rb +1 -1
- data/test/test_phone_number_it.rb +12 -0
- data/test/test_phone_number_ja.rb +63 -0
- data/test/test_phone_number_kr.rb +1 -1
- data/test/test_phone_number_mx.rb +1 -1
- data/test/test_phone_number_nl.rb +1 -1
- data/test/test_phone_number_pl.rb +1 -1
- data/test/test_phone_number_se.rb +1 -1
- data/test/test_phone_number_sg.rb +1 -1
- data/test/test_phone_number_sn.rb +1 -1
- data/test/test_phone_number_tw.rb +1 -1
- data/test/test_phone_number_ua.rb +1 -1
- data/test/test_products.rb +1 -1
- data/test/test_sem_ver.rb +1 -1
- data/test/test_skill.rb +1 -1
- data/test/test_sport_pl.rb +1 -1
- data/test/test_sport_ru.rb +30 -0
- data/test/test_sport_us.rb +1 -1
- data/test/test_sports.rb +1 -1
- data/test/test_ssn.rb +1 -1
- data/test/test_ssn_mx.rb +1 -1
- data/test/test_ssn_se.rb +2 -2
- data/test/test_string.rb +4 -4
- data/test/test_time.rb +3 -4
- data/test/test_tweet.rb +5 -5
- data/test/test_unique_utils.rb +1 -1
- data/test/test_units.rb +2 -1
- data/test/test_units_english.rb +1 -1
- data/test/test_units_metric.rb +1 -1
- data/test/test_vehicle.rb +3 -3
- data/test/test_venue.rb +1 -1
- data/test/test_youtube.rb +1 -1
- metadata +232 -160
data/test/test_gender_id.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
class TestFakerGenderIT < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
GENDER_REGEX = /\A(maschio|femmina)\z/.freeze
|
9
|
+
|
10
|
+
assert_methods_are_deterministic(FFaker::GenderIT, :random)
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@tester = FFaker::GenderIT
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_random
|
17
|
+
assert_match(GENDER_REGEX, @tester.random)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_sample
|
21
|
+
assert_match(GENDER_REGEX, @tester.sample)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_maybe
|
25
|
+
assert_match(GENDER_REGEX, @tester.maybe)
|
26
|
+
end
|
27
|
+
end
|
data/test/test_gender_ja.rb
CHANGED
data/test/test_gender_jp.rb
CHANGED
data/test/test_gender_kr.rb
CHANGED
data/test/test_gender_pl.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
class TestFakerGenderRU < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(FFaker::GenderRU, :binary, :random)
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@tester = FFaker::GenderRU
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_random
|
15
|
+
gender_regex = /\A(?:мужчина|женщина|нонбайнари|агендер)\z/
|
16
|
+
assert_match(gender_regex, @tester.random)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_binary
|
20
|
+
gender_regex = /\A(?:мужчина|женщина)\z/
|
21
|
+
assert_match(gender_regex, @tester.binary)
|
22
|
+
end
|
23
|
+
end
|
data/test/test_geolocation.rb
CHANGED
data/test/test_guid.rb
CHANGED
data/test/test_healthcare_ru.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestHealthcareRU < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
7
7
|
|
8
|
-
SPECIALIZATION_REGEX = /\A[А-Яа-я\
|
8
|
+
SPECIALIZATION_REGEX = /\A[А-Яа-я\ ()\-]+\z/.freeze
|
9
9
|
|
10
10
|
assert_methods_are_deterministic(FFaker::HealthcareRU, :doctor_specialization)
|
11
11
|
|
data/test/test_hipster_ipsum.rb
CHANGED
data/test/test_html_ipsum.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestHTMLIpsum < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
@@ -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
|
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
|
data/test/test_identification.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestFakerIdentificationESCO < Test::Unit::TestCase
|
6
6
|
include Test::Unit::Assertions
|
@@ -28,7 +28,7 @@ class TestFakerIdentificationESCO < Test::Unit::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_category
|
31
|
-
assert_match(/\A(
|
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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestFakerIdentificationESCL < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
@@ -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}
|
15
|
+
assert_match(/\b\d{7,8}-[k|0-9]/i, @tester.rut)
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
class TestFakerIdentificationIT < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::IdentificationIT,
|
10
|
+
:drivers_license, :ssn, :gender, :ethnicity
|
11
|
+
)
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@tester = FFaker::IdentificationIT
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_drivers_license
|
18
|
+
drivers_license_regex = /\AU1[1-9]\d{7}[A-Z]\z/
|
19
|
+
assert_match(drivers_license_regex, @tester.drivers_license)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_ssn
|
23
|
+
assert_match(/\A\d{20}\z/, @tester.ssn)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_gender
|
27
|
+
assert_match(/\A(Maschio|Femmina)\z/, @tester.gender)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_ethnicity
|
31
|
+
ethnicity_regex = %r{\A(Afroamericano|Asiatico/isolano del Pacifico|Caucasico|Ispanico|Nativo americano|Multirazziale|Altro|Preferisco non rispondere)\z}
|
32
|
+
assert_match(ethnicity_regex, @tester.ethnicity)
|
33
|
+
end
|
34
|
+
end
|
data/test/test_image.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestImage < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
7
7
|
|
8
|
-
PLACEHOLDER = 'https://
|
8
|
+
PLACEHOLDER = 'https://dummyimage.com/'
|
9
9
|
|
10
10
|
assert_methods_are_deterministic(FFaker::Image, :url)
|
11
11
|
|
@@ -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
|
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
|
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
|
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
|
|
data/test/test_internet.rb
CHANGED
data/test/test_internet_se.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestFakerInternetSE < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
@@ -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]+(_
|
76
|
+
assert @tester.slug.match(/^[a-z]+(_|\.|-)[a-z]+$/)
|
77
77
|
end
|
78
78
|
end
|
data/test/test_job.rb
CHANGED
data/test/test_job_br.rb
CHANGED
data/test/test_job_cn.rb
CHANGED
data/test/test_job_fr.rb
CHANGED
data/test/test_job_it.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
class TestFakerJobIT < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(FFaker::JobIT, :title)
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@tester = FFaker::JobIT
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_title
|
15
|
+
assert_match(/\A(\w+\.? ?){2,3}\z/, @tester.title)
|
16
|
+
end
|
17
|
+
end
|
data/test/test_job_ja.rb
CHANGED
data/test/test_job_kr.rb
CHANGED
data/test/test_job_vn.rb
CHANGED
data/test/test_locale.rb
CHANGED
data/test/test_lorem.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestLorem < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
@@ -51,4 +51,8 @@ class TestLorem < Test::Unit::TestCase
|
|
51
51
|
assert FFaker::Lorem.characters(10).length == 10
|
52
52
|
assert FFaker::Lorem.characters(-1) == ''
|
53
53
|
end
|
54
|
+
|
55
|
+
def test_word_collection_uniqueness
|
56
|
+
assert_equal(FFaker::Lorem::WORDS, FFaker::Lorem::WORDS.uniq)
|
57
|
+
end
|
54
58
|
end
|
data/test/test_lorem_ar.rb
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'helper'
|
4
|
+
|
5
|
+
class TestLoremBR < Test::Unit::TestCase
|
6
|
+
include DeterministicHelper
|
7
|
+
|
8
|
+
assert_methods_are_deterministic(
|
9
|
+
FFaker::LoremBR,
|
10
|
+
:paragraph, :sentence, :phrase, :paragraphs, :sentences, :phrases, :words, :word, :characters
|
11
|
+
)
|
12
|
+
|
13
|
+
CHARACTERS = /\A[A-zÀ-ü0-9]+\z/i
|
14
|
+
WORD = /\A[A-zÀ-ü-]+\z/i
|
15
|
+
WORDS = /[ A-zÀ-ü-.]+/i
|
16
|
+
|
17
|
+
def test_paragraph
|
18
|
+
assert_match(WORDS, FFaker::LoremBR.paragraph)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_sentence
|
22
|
+
assert_match(WORDS, FFaker::LoremBR.sentence)
|
23
|
+
assert_nothing_thrown do
|
24
|
+
100.times { FFaker::LoremBR.sentence 0 }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_phrase
|
29
|
+
assert_match(WORDS, FFaker::LoremBR.phrase)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_paragraphs
|
33
|
+
assert_match(WORDS, FFaker::LoremBR.paragraphs.join(' '))
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_sentences
|
37
|
+
assert_match(WORDS, FFaker::LoremBR.sentences.join(' '))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_phrases
|
41
|
+
assert_match(WORDS, FFaker::LoremBR.phrases.join(' '))
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_words
|
45
|
+
assert_match(WORDS, FFaker::LoremBR.words.join(' '))
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_word
|
49
|
+
assert_match(WORD, FFaker::LoremBR.word)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_characters
|
53
|
+
assert_match(CHARACTERS, FFaker::LoremBR.characters)
|
54
|
+
assert FFaker::LoremBR.characters.length == 255
|
55
|
+
assert FFaker::LoremBR.characters(10).length == 10
|
56
|
+
assert FFaker::LoremBR.characters(-1) == ''
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_word_collection_uniqueness
|
60
|
+
assert_equal(FFaker::Lorem::WORDS, FFaker::Lorem::WORDS.uniq)
|
61
|
+
end
|
62
|
+
end
|
data/test/test_lorem_cn.rb
CHANGED
data/test/test_lorem_fr.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestLoremFR < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
@@ -11,17 +11,19 @@ class TestLoremFR < Test::Unit::TestCase
|
|
11
11
|
)
|
12
12
|
|
13
13
|
REGEX = /\A[ -.ÀÂÉÈÊÎÔÚÛàâéèêîôùûa-z]+\z/i.freeze
|
14
|
+
REGEX_WORD = /\A[-ÀÂÉÈÊÎÔÚÛàâéèêîôùûa-z]+\z/i.freeze
|
15
|
+
REGEX_WORDS = /\A[ -ÀÂÉÈÊÎÔÚÛàâéèêîôùûa-z]+\z/i.freeze
|
14
16
|
|
15
17
|
def test_paragraph
|
16
|
-
assert_match(
|
18
|
+
assert_match(REGEX, FFaker::LoremFR.paragraph)
|
17
19
|
end
|
18
20
|
|
19
21
|
def test_sentence
|
20
|
-
assert_match(
|
22
|
+
assert_match(REGEX, FFaker::LoremFR.sentence)
|
21
23
|
end
|
22
24
|
|
23
25
|
def test_phrase
|
24
|
-
assert_match(
|
26
|
+
assert_match(REGEX, FFaker::LoremFR.phrase)
|
25
27
|
end
|
26
28
|
|
27
29
|
def test_paragraphs
|
@@ -29,18 +31,18 @@ class TestLoremFR < Test::Unit::TestCase
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def test_sentences
|
32
|
-
assert_match(
|
34
|
+
assert_match(REGEX, FFaker::LoremFR.sentences.join(' '))
|
33
35
|
end
|
34
36
|
|
35
37
|
def test_phrases
|
36
|
-
assert_match(
|
38
|
+
assert_match(REGEX, FFaker::LoremFR.phrases.join(' '))
|
37
39
|
end
|
38
40
|
|
39
41
|
def test_words
|
40
|
-
assert_match(
|
42
|
+
assert_match(REGEX_WORDS, FFaker::LoremFR.words.join(' '))
|
41
43
|
end
|
42
44
|
|
43
45
|
def test_word
|
44
|
-
assert_match(
|
46
|
+
assert_match(REGEX_WORD, FFaker::LoremFR.word)
|
45
47
|
end
|
46
48
|
end
|