ffaker 2.22.0 → 2.23.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 +120 -17
- data/Gemfile +15 -0
- data/README.md +3 -2
- data/REFERENCE.md +885 -868
- data/Rakefile +7 -7
- data/ffaker.gemspec +2 -6
- data/lib/ffaker/address.rb +4 -4
- data/lib/ffaker/address_fr.rb +3 -5
- data/lib/ffaker/address_it.rb +1 -4
- data/lib/ffaker/avatar.rb +11 -3
- data/lib/ffaker/bank.rb +1 -1
- data/lib/ffaker/bank_us.rb +33 -0
- data/lib/ffaker/book.rb +10 -2
- data/lib/ffaker/cheesy_lingo.rb +2 -2
- data/lib/ffaker/code.rb +1 -1
- data/lib/ffaker/company.rb +1 -1
- data/lib/ffaker/company_fr.rb +1 -1
- data/lib/ffaker/crypto.rb +14 -0
- data/lib/ffaker/date.rb +9 -0
- data/lib/ffaker/filesystem.rb +12 -2
- data/lib/ffaker/identification_br.rb +2 -11
- data/lib/ffaker/identification_ec.rb +1 -1
- data/lib/ffaker/identification_es_cl.rb +1 -1
- data/lib/ffaker/identification_kr.rb +10 -3
- data/lib/ffaker/identification_pl.rb +2 -2
- data/lib/ffaker/image.rb +28 -4
- data/lib/ffaker/lorem_ja.rb +1 -1
- data/lib/ffaker/lorem_ru.rb +1 -1
- data/lib/ffaker/movie.rb +1 -1
- data/lib/ffaker/name_fr.rb +4 -3
- data/lib/ffaker/number.rb +4 -0
- data/lib/ffaker/phone_number_de.rb +3 -3
- data/lib/ffaker/skill.rb +1 -1
- data/lib/ffaker/ssn.rb +4 -2
- data/lib/ffaker/string.rb +1 -1
- data/lib/ffaker/utils/module_utils.rb +2 -2
- data/lib/ffaker/utils/unique_utils.rb +9 -5
- data/lib/ffaker/version.rb +1 -1
- data/lib/ffaker.rb +60 -191
- data/scripts/reference.rb +8 -10
- data/test/helper.rb +1 -1
- data/test/test_avatar.rb +30 -7
- data/test/test_bank_us.rb +35 -0
- data/test/test_book.rb +29 -0
- data/test/test_crypto.rb +15 -0
- data/test/test_date.rb +11 -1
- data/test/test_filesystem.rb +28 -2
- data/test/test_healthcare_ru.rb +1 -1
- data/test/test_identification.rb +12 -2
- data/test/test_identification_ec.rb +1 -1
- data/test/test_identification_es_mx.rb +3 -1
- data/test/test_identification_it.rb +12 -1
- data/test/test_identification_kr.rb +3 -3
- data/test/test_image.rb +51 -5
- data/test/test_internet.rb +3 -1
- data/test/test_internet_se.rb +3 -1
- data/test/test_lorem_br.rb +1 -1
- data/test/test_lorem_ru.rb +1 -1
- data/test/test_lorem_ua.rb +1 -1
- data/test/test_name_ua.rb +1 -1
- data/test/test_number.rb +13 -1
- data/test/test_phone_number_nl.rb +1 -1
- data/test/test_unique_utils.rb +4 -0
- data/test/test_units.rb +6 -6
- data/test/test_units_english.rb +15 -15
- data/test/test_units_metric.rb +15 -15
- metadata +7 -45
data/test/test_image.rb
CHANGED
@@ -18,34 +18,80 @@ class TestImage < Test::Unit::TestCase
|
|
18
18
|
@tester.url)
|
19
19
|
end
|
20
20
|
|
21
|
+
def test_url_output_with_keyword_arguments
|
22
|
+
output = capture_output do
|
23
|
+
@tester.url(format: 'jpg')
|
24
|
+
end
|
25
|
+
|
26
|
+
assert_equal ['', ''], output
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_url_with_size_as_positional_argument
|
30
|
+
assert_match(%r(#{Regexp.quote(PLACEHOLDER)}150x320/[0-9a-f]{6}/[0-9a-f]{6}\.png\?text=), @tester.url('150x320'))
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_url_output_with_positional_arguments
|
34
|
+
output = capture_output do
|
35
|
+
@tester.url('150x320')
|
36
|
+
end
|
37
|
+
|
38
|
+
assert_equal(
|
39
|
+
['', "Positional arguments for Image#url are deprecated. Please use keyword arguments.\n"],
|
40
|
+
output
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
21
44
|
def test_image_url_with_param
|
22
45
|
assert_equal("#{PLACEHOLDER}300x300//.png?text=",
|
23
|
-
@tester.url('300x300', 'png', nil, nil))
|
46
|
+
@tester.url(size: '300x300', format: 'png', bg_color: nil, text_color: nil))
|
24
47
|
end
|
25
48
|
|
26
49
|
def test_image_url_with_correct_size
|
27
50
|
assert_match(%r(#{Regexp.quote(PLACEHOLDER)}150x320/[0-9a-f]{6}/[0-9a-f]{6}\.png\?text=),
|
28
|
-
@tester.url('150x320'))
|
51
|
+
@tester.url(size: '150x320'))
|
29
52
|
end
|
30
53
|
|
31
54
|
def test_image_url_with_incorrect_size
|
32
55
|
assert_raise ArgumentError do
|
33
|
-
@tester.url('150x320z')
|
56
|
+
@tester.url(size: '150x320z')
|
34
57
|
end
|
35
58
|
end
|
36
59
|
|
37
60
|
def test_image_url_with_supported_format
|
38
61
|
assert_match(%r(#{Regexp.quote(PLACEHOLDER)}300x300/[0-9a-f]{6}/[0-9a-f]{6}\.jpg\?text=),
|
39
|
-
@tester.url('300x300', 'jpg'))
|
62
|
+
@tester.url(size: '300x300', format: 'jpg'))
|
40
63
|
end
|
41
64
|
|
42
65
|
def test_image_url_with_incorrect_format
|
43
66
|
assert_raise ArgumentError do
|
44
|
-
@tester.url('300x300', 'wrong_format')
|
67
|
+
@tester.url(size: '300x300', format: 'wrong_format')
|
45
68
|
end
|
46
69
|
end
|
47
70
|
|
48
71
|
def test_image_file
|
49
72
|
assert_equal(@tester.file.class.name, 'File')
|
50
73
|
end
|
74
|
+
|
75
|
+
def test_file_output_with_keyword_arguments
|
76
|
+
output = capture_output do
|
77
|
+
@tester.file(format: 'jpg')
|
78
|
+
end
|
79
|
+
|
80
|
+
assert_equal ['', ''], output
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_file_with_size_as_positional_argument
|
84
|
+
assert_equal(@tester.file('150x320').class.name, 'File')
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_file_output_with_positional_arguments
|
88
|
+
output = capture_output do
|
89
|
+
@tester.file('150x320')
|
90
|
+
end
|
91
|
+
|
92
|
+
assert_equal(
|
93
|
+
['', "Positional arguments for Image#file are deprecated. Please use keyword arguments.\n"],
|
94
|
+
output
|
95
|
+
)
|
96
|
+
end
|
51
97
|
end
|
data/test/test_internet.rb
CHANGED
@@ -29,7 +29,9 @@ class TestFakerInternet < Test::Unit::TestCase
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_disposable_email
|
32
|
-
assert @tester.disposable_email.match(
|
32
|
+
assert @tester.disposable_email.match(
|
33
|
+
/.+@(mailinator\.com|suremail\.info|spamherelots\.com|binkmail\.com|safetymail\.info)/
|
34
|
+
)
|
33
35
|
end
|
34
36
|
|
35
37
|
def test_safe_email
|
data/test/test_internet_se.rb
CHANGED
@@ -25,7 +25,9 @@ class TestFakerInternetSE < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_disposable_email
|
28
|
-
assert @tester.disposable_email.match(
|
28
|
+
assert @tester.disposable_email.match(
|
29
|
+
/.+@(mailinator\.com|suremail\.info|spamherelots\.com|binkmail\.com|safetymail\.info)/
|
30
|
+
)
|
29
31
|
end
|
30
32
|
|
31
33
|
def test_free_email
|
data/test/test_lorem_br.rb
CHANGED
data/test/test_lorem_ru.rb
CHANGED
data/test/test_lorem_ua.rb
CHANGED
@@ -7,7 +7,7 @@ class TestLoremUA < Test::Unit::TestCase
|
|
7
7
|
|
8
8
|
SENTENCE_MATCHER = /\A[а-яА-ЯіїєґІЇЄҐ’\-\s.!?,]+\z/
|
9
9
|
WORDS_MATCHER = /\A[а-яА-ЯіїєґІЇЄҐ’\-\s]+\z/
|
10
|
-
WORD_MATCHER = /\A[
|
10
|
+
WORD_MATCHER = /\A[а-яА-ЯіїєґІЇЄҐ’-]+\z/
|
11
11
|
|
12
12
|
assert_methods_are_deterministic(
|
13
13
|
FFaker::LoremUA,
|
data/test/test_name_ua.rb
CHANGED
@@ -15,7 +15,7 @@ class TestNameUA < Test::Unit::TestCase
|
|
15
15
|
def setup
|
16
16
|
@tester = FFaker::NameUA
|
17
17
|
|
18
|
-
@single_word_name_regexp = /\A[
|
18
|
+
@single_word_name_regexp = /\A[а-яА-ЯіїєґІЇЄҐ’-]+\z/
|
19
19
|
@multiple_words_name_regexp = /\A[а-яА-ЯіїєґІЇЄҐ’\-\s]+\z/
|
20
20
|
end
|
21
21
|
|
data/test/test_number.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'helper'
|
|
5
5
|
class TestNumber < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
7
7
|
|
8
|
-
assert_methods_are_deterministic(FFaker::Number, :number, :decimal)
|
8
|
+
assert_methods_are_deterministic(FFaker::Number, :number, :decimal, :between)
|
9
9
|
|
10
10
|
def setup
|
11
11
|
@tester = FFaker::Number
|
@@ -42,4 +42,16 @@ class TestNumber < Test::Unit::TestCase
|
|
42
42
|
@tester.decimal(fractional_digits: 0)
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
def test_between
|
47
|
+
from = -50
|
48
|
+
to = 50
|
49
|
+
assert_random_between(from..to) { @tester.between(from: from, to: to) }
|
50
|
+
assert_instance_of Integer, @tester.between(from: from, to: to)
|
51
|
+
|
52
|
+
from = -50.0
|
53
|
+
to = 50.0
|
54
|
+
assert_random_between(from..to) { @tester.between(from: from, to: to) }
|
55
|
+
assert_instance_of Float, @tester.between(from: from, to: to)
|
56
|
+
end
|
45
57
|
end
|
data/test/test_unique_utils.rb
CHANGED
data/test/test_units.rb
CHANGED
@@ -13,25 +13,25 @@ class TestUnits < Test::Unit::TestCase
|
|
13
13
|
|
14
14
|
def setup
|
15
15
|
@tester = FFaker::Unit
|
16
|
-
@time_units = @tester::TIME_UNITS
|
17
|
-
@temperature_units = @tester::TEMPERATURE_UNITS
|
16
|
+
@time_units = @tester::TIME_UNITS
|
17
|
+
@temperature_units = @tester::TEMPERATURE_UNITS
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_time_name
|
21
|
-
assert_include @time_units.map
|
21
|
+
assert_include @time_units.map { |unit| unit[:name] }, @tester.time_name
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_time_abbr
|
25
|
-
assert_include @time_units.map
|
25
|
+
assert_include @time_units.map { |unit| unit[:abbreviation] }, @tester.time_abbr
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_temperature_name
|
29
|
-
assert_include @temperature_units.map
|
29
|
+
assert_include @temperature_units.map { |unit| unit[:name] }, @tester.temperature_name
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_temperature_abbr
|
33
33
|
assert_include \
|
34
|
-
@temperature_units.map
|
34
|
+
@temperature_units.map { |unit| unit[:abbreviation] },
|
35
35
|
@tester.temperature_abbr
|
36
36
|
end
|
37
37
|
end
|
data/test/test_units_english.rb
CHANGED
@@ -14,50 +14,50 @@ class TestUnitsEnglish < Test::Unit::TestCase
|
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@tester = FFaker::UnitEnglish
|
17
|
-
@length_units = @tester::LENGTH_UNITS
|
18
|
-
@mass_units = @tester::MASS_UNITS
|
19
|
-
@liquid_units = @tester::LIQUID_UNITS
|
20
|
-
@volume_units = @tester::VOLUME_UNITS
|
21
|
-
@area_units = @tester::AREA_UNITS
|
17
|
+
@length_units = @tester::LENGTH_UNITS
|
18
|
+
@mass_units = @tester::MASS_UNITS
|
19
|
+
@liquid_units = @tester::LIQUID_UNITS
|
20
|
+
@volume_units = @tester::VOLUME_UNITS
|
21
|
+
@area_units = @tester::AREA_UNITS
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_length_name
|
25
|
-
assert_include @length_units.map
|
25
|
+
assert_include @length_units.map { |unit| unit[:name] }, @tester.length_name
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_length_abbrev
|
29
|
-
assert_include @length_units.map
|
29
|
+
assert_include @length_units.map { |unit| unit[:abbreviation] }, @tester.length_abbr
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_mass_name
|
33
|
-
assert_include @mass_units.map
|
33
|
+
assert_include @mass_units.map { |unit| unit[:name] }, @tester.mass_name
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_mass_abbr
|
37
|
-
assert_include @mass_units.map
|
37
|
+
assert_include @mass_units.map { |unit| unit[:abbreviation] }, @tester.mass_abbr
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_liquid_name
|
41
|
-
assert_include @liquid_units.map
|
41
|
+
assert_include @liquid_units.map { |unit| unit[:name] }, @tester.liquid_name
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_liquid_abbr
|
45
|
-
assert_include @liquid_units.map
|
45
|
+
assert_include @liquid_units.map { |unit| unit[:abbreviation] }, @tester.liquid_abbr
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_volume_name
|
49
|
-
assert_include @volume_units.map
|
49
|
+
assert_include @volume_units.map { |unit| unit[:name] }, @tester.volume_name
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_volume_abbr
|
53
|
-
assert_include @volume_units.map
|
53
|
+
assert_include @volume_units.map { |unit| unit[:abbreviation] }, @tester.volume_abbr
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_area_name
|
57
|
-
assert_include @area_units.map
|
57
|
+
assert_include @area_units.map { |unit| unit[:name] }, @tester.area_name
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_area_abbr
|
61
|
-
assert_include @area_units.map
|
61
|
+
assert_include @area_units.map { |unit| unit[:abbreviation] }, @tester.area_abbr
|
62
62
|
end
|
63
63
|
end
|
data/test/test_units_metric.rb
CHANGED
@@ -14,50 +14,50 @@ class TestUnitsMetric < Test::Unit::TestCase
|
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@tester = FFaker::UnitMetric
|
17
|
-
@length_units = @tester::LENGTH_UNITS
|
18
|
-
@mass_units = @tester::MASS_UNITS
|
19
|
-
@liquid_units = @tester::LIQUID_UNITS
|
20
|
-
@volume_units = @tester::VOLUME_UNITS
|
21
|
-
@area_units = @tester::AREA_UNITS
|
17
|
+
@length_units = @tester::LENGTH_UNITS
|
18
|
+
@mass_units = @tester::MASS_UNITS
|
19
|
+
@liquid_units = @tester::LIQUID_UNITS
|
20
|
+
@volume_units = @tester::VOLUME_UNITS
|
21
|
+
@area_units = @tester::AREA_UNITS
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_length_name
|
25
|
-
assert_include @length_units.map
|
25
|
+
assert_include @length_units.map { |unit| unit[:name] }, @tester.length_name
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_length_abbrev
|
29
|
-
assert_include @length_units.map
|
29
|
+
assert_include @length_units.map { |unit| unit[:abbreviation] }, @tester.length_abbr
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_mass_name
|
33
|
-
assert_include @mass_units.map
|
33
|
+
assert_include @mass_units.map { |unit| unit[:name] }, @tester.mass_name
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_mass_abbr
|
37
|
-
assert_include @mass_units.map
|
37
|
+
assert_include @mass_units.map { |unit| unit[:abbreviation] }, @tester.mass_abbr
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_liquid_name
|
41
|
-
assert_include @liquid_units.map
|
41
|
+
assert_include @liquid_units.map { |unit| unit[:name] }, @tester.liquid_name
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_liquid_abbr
|
45
|
-
assert_include @liquid_units.map
|
45
|
+
assert_include @liquid_units.map { |unit| unit[:abbreviation] }, @tester.liquid_abbr
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_volume_name
|
49
|
-
assert_include @volume_units.map
|
49
|
+
assert_include @volume_units.map { |unit| unit[:name] }, @tester.volume_name
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_volume_abbr
|
53
|
-
assert_include @volume_units.map
|
53
|
+
assert_include @volume_units.map { |unit| unit[:abbreviation] }, @tester.volume_abbr
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_area_name
|
57
|
-
assert_include @area_units.map
|
57
|
+
assert_include @area_units.map { |unit| unit[:name] }, @tester.area_name
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_area_abbr
|
61
|
-
assert_include @area_units.map
|
61
|
+
assert_include @area_units.map { |unit| unit[:abbreviation] }, @tester.area_abbr
|
62
62
|
end
|
63
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/ffaker/ffaker/graphs/contributors
|
@@ -9,50 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rake
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '13.0'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '13.0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rubocop
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: test-unit
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
12
|
+
date: 2023-09-19 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
56
14
|
description: Ffaker generates dummy data.
|
57
15
|
email: EmmanuelOga@gmail.com
|
58
16
|
executables: []
|
@@ -110,6 +68,7 @@ files:
|
|
110
68
|
- lib/ffaker/aws.rb
|
111
69
|
- lib/ffaker/bacon_ipsum.rb
|
112
70
|
- lib/ffaker/bank.rb
|
71
|
+
- lib/ffaker/bank_us.rb
|
113
72
|
- lib/ffaker/book.rb
|
114
73
|
- lib/ffaker/boolean.rb
|
115
74
|
- lib/ffaker/cheesy_lingo.rb
|
@@ -125,6 +84,7 @@ files:
|
|
125
84
|
- lib/ffaker/company_se.rb
|
126
85
|
- lib/ffaker/conference.rb
|
127
86
|
- lib/ffaker/courses_fr.rb
|
87
|
+
- lib/ffaker/crypto.rb
|
128
88
|
- lib/ffaker/currency.rb
|
129
89
|
- lib/ffaker/data/address/city_suffixes
|
130
90
|
- lib/ffaker/data/address/country
|
@@ -675,6 +635,7 @@ files:
|
|
675
635
|
- test/test_aws.rb
|
676
636
|
- test/test_bacon_ipsum.rb
|
677
637
|
- test/test_bank.rb
|
638
|
+
- test/test_bank_us.rb
|
678
639
|
- test/test_book.rb
|
679
640
|
- test/test_boolean.rb
|
680
641
|
- test/test_cheesy_lingo.rb
|
@@ -691,6 +652,7 @@ files:
|
|
691
652
|
- test/test_conference.rb
|
692
653
|
- test/test_course_mathematiques.rb
|
693
654
|
- test/test_course_philosophie.rb
|
655
|
+
- test/test_crypto.rb
|
694
656
|
- test/test_currency.rb
|
695
657
|
- test/test_date.rb
|
696
658
|
- test/test_dizzle_ipsum.rb
|