faker 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +3 -0
- data/README.md +1 -6
- data/lib/faker/address.rb +1 -1
- data/lib/faker/code.rb +6 -6
- data/lib/faker/lorem.rb +9 -9
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en.yml +3 -1
- data/test/test_faker_company.rb +2 -5
- data/test/test_faker_street.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 388ce6e6400da23238b626370b32f0294421df15
|
4
|
+
data.tar.gz: 87d1240d2e49881fd848834b6541334dbc750bb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbad50f565fa058744b4bdad1ff92cf0cb741535b86dd3d0d56cc7ddd15b4acdf337ea67390dc89359d2f94225b586e6fce5c5411880020c917ffa33ad91096c
|
7
|
+
data.tar.gz: 1d7601d9c39cc6b981f1763f63069d8215f9e8666e16d7ee242bcc8ce5072bda0e1ae5ecea8d7ec74b37372a6d85b97a4031d7b92c116553331dc0a7a37c07bd
|
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -349,12 +349,7 @@ rest.
|
|
349
349
|
|
350
350
|
Contributing
|
351
351
|
------------
|
352
|
-
|
353
|
-
the project at [github](https://github.com/stympy/faker), make your changes,
|
354
|
-
then send a pull request.
|
355
|
-
|
356
|
-
**note**
|
357
|
-
Run `bundle install` and `rake test` to confirm tests are passing.
|
352
|
+
See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/master/CONTRIBUTING.md).
|
358
353
|
|
359
354
|
Contact
|
360
355
|
-------
|
data/lib/faker/address.rb
CHANGED
data/lib/faker/code.rb
CHANGED
@@ -41,18 +41,18 @@ module Faker
|
|
41
41
|
|
42
42
|
def generate_base8_ean
|
43
43
|
values = regexify(/\d{7}/)
|
44
|
-
check_digit = values.split(//).each_with_index.inject(0){ |s, (v, i)| s + v.to_i * EAN_CHECK_DIGIT8[i] } % 10
|
45
|
-
values << (10
|
44
|
+
check_digit = 10 - values.split(//).each_with_index.inject(0){ |s, (v, i)| s + v.to_i * EAN_CHECK_DIGIT8[i] } % 10
|
45
|
+
values << (check_digit == 10 ? 0 : check_digit).to_s
|
46
46
|
end
|
47
47
|
|
48
48
|
def generate_base13_ean
|
49
49
|
values = regexify(/\d{12}/)
|
50
|
-
check_digit = values.split(//).each_with_index.inject(0){ |s, (v, i)| s + v.to_i * EAN_CHECK_DIGIT13[i] } % 10
|
51
|
-
values << (10
|
50
|
+
check_digit = 10 - values.split(//).each_with_index.inject(0){ |s, (v, i)| s + v.to_i * EAN_CHECK_DIGIT13[i] } % 10
|
51
|
+
values << (check_digit == 10 ? 0 : check_digit).to_s
|
52
52
|
end
|
53
53
|
|
54
|
-
EAN_CHECK_DIGIT8 = [3, 1, 3, 1, 3, 1, 3
|
55
|
-
EAN_CHECK_DIGIT13 = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3
|
54
|
+
EAN_CHECK_DIGIT8 = [3, 1, 3, 1, 3, 1, 3]
|
55
|
+
EAN_CHECK_DIGIT13 = [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]
|
56
56
|
|
57
57
|
def rut_verificator_digit(rut)
|
58
58
|
total = rut.to_s.rjust(8, '0').split(//).zip(%w(3 2 7 6 5 4 3 2)).collect{|a, b| a.to_i * b.to_i}.inject(:+)
|
data/lib/faker/lorem.rb
CHANGED
@@ -45,17 +45,17 @@ module Faker
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
|
-
end
|
49
48
|
|
50
|
-
|
49
|
+
private
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
# If an array or range is passed, a random value will be selected.
|
52
|
+
# All other values are simply returned.
|
53
|
+
def resolve(value)
|
54
|
+
case value
|
55
|
+
when Array then value[rand(value.size)]
|
56
|
+
when Range then rand((value.last+1) - value.first) + value.first
|
57
|
+
else value
|
58
|
+
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/lib/faker/version.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -116,7 +116,9 @@ en:
|
|
116
116
|
- "#{first_name} #{last_name}"
|
117
117
|
|
118
118
|
phone_number:
|
119
|
-
formats: ['###-###-####', '(###)###-####', '1-###-###-####', '###.###.####', '###-###-####', '(###)###-####', '1-###-###-####', '###.###.####', '###-###-#### x###', '(###)###-#### x###', '1-###-###-#### x###', '###.###.#### x###', '###-###-#### x####', '(###)###-#### x####', '1-###-###-#### x####', '###.###.#### x####', '###-###-#### x#####', '(###)###-#### x#####', '1-###-###-#### x#####', '###.###.#### x#####']
|
119
|
+
formats: ['###-###-####', '(###) ###-####', '1-###-###-####', '###.###.####', '###-###-####', '(###) ###-####', '1-###-###-####', '###.###.####', '###-###-#### x###', '(###) ###-#### x###', '1-###-###-#### x###', '###.###.#### x###', '###-###-#### x####', '(###) ###-#### x####', '1-###-###-#### x####', '###.###.#### x####', '###-###-#### x#####', '(###) ###-#### x#####', '1-###-###-#### x#####', '###.###.#### x#####']
|
120
|
+
cell_phone:
|
121
|
+
formats: ['###-###-####', '(###) ###-####', '1-###-###-####', '###.###.####']
|
120
122
|
|
121
123
|
business:
|
122
124
|
credit_card_numbers: ['1234-2121-1221-1211', '1212-1221-1121-1234', '1211-1221-1234-2201', '1228-1221-1221-1431']
|
data/test/test_faker_company.rb
CHANGED
@@ -9,10 +9,7 @@ class TestFakerCompany < Test::Unit::TestCase
|
|
9
9
|
assert @tester.duns_number.match(/\d\d-\d\d\d-\d\d\d\d/)
|
10
10
|
end
|
11
11
|
|
12
|
-
require "open-uri"
|
13
12
|
def test_logo
|
14
|
-
|
15
|
-
assert f.readline.include?("GIF")
|
16
|
-
end
|
13
|
+
assert @tester.logo.match(%r{http://www.biz-logo.com/examples/\d+\.gif})
|
17
14
|
end
|
18
|
-
end
|
15
|
+
end
|
data/test/test_faker_street.rb
CHANGED
@@ -36,10 +36,10 @@ class TestFakerStreet < Test::Unit::TestCase
|
|
36
36
|
assert_match(/Wide Cheerful Path \d \(Green Door\)/, Faker::Address.street_address(:include_secondary))
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def test_street_address_with_locale_fallback
|
41
41
|
I18n.with_locale('en-GB') do
|
42
|
-
assert_match(/^\d+ \w+ \w+/, Faker::Address.street_address)
|
42
|
+
assert_match(/^\d+ [\w']+ \w+/, Faker::Address.street_address)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Curtis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|