faux_data 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/faux_data.rb +2 -1
- data/lib/faux_data/compatibility.rb +5 -0
- data/test/test_national_id_generator.rb +11 -0
- data/test/test_person.rb +5 -1
- metadata +24 -42
data/README.md
CHANGED
data/lib/faux_data.rb
CHANGED
@@ -28,4 +28,15 @@ class Test_SSN_Creation < Test::Unit::TestCase
|
|
28
28
|
assert_equal(ids.size, nid.national_ids.size, "Both arrays should contain 100 elements ")
|
29
29
|
assert(ids == nid.national_ids, "Both arrays should contain the same 100 elements ")
|
30
30
|
end
|
31
|
+
|
32
|
+
def test_ssn_unique
|
33
|
+
nid = FauxData::NationalIdGenerator.new(:country_code => 'us')
|
34
|
+
ids = Array.new
|
35
|
+
limit = 10_000
|
36
|
+
(1..limit).each do |i|
|
37
|
+
id = nid.national_id
|
38
|
+
ids << id
|
39
|
+
end
|
40
|
+
assert(ids.uniq.size == limit, "Found some duplicate SSNs, but should be unique")
|
41
|
+
end
|
31
42
|
end
|
data/test/test_person.rb
CHANGED
@@ -13,7 +13,9 @@ class Test_Person_Creation < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_person_creation
|
16
|
-
required_keys = %w[ssn surname first_name middle_name
|
16
|
+
required_keys = %w[ssn surname first_name middle_name
|
17
|
+
street city state zip date_of_birth
|
18
|
+
email sex ].map {|i| i.downcase.to_sym}
|
17
19
|
pg = FauxData::PersonGenerator.new
|
18
20
|
person = pg.person
|
19
21
|
assert(person.is_a?(Hash), "Person should be a hash")
|
@@ -21,6 +23,7 @@ class Test_Person_Creation < Test::Unit::TestCase
|
|
21
23
|
assert(person.key?(k), "Should have this key: #{k}")
|
22
24
|
end
|
23
25
|
assert(person[:date_of_birth].is_a?(Date), "Date of Birth should be a date object")
|
26
|
+
assert(required_keys.size == person.keys.size, "Mismatch on required person attributes: #{required_keys.size} <> #{person.keys.size}")
|
24
27
|
|
25
28
|
end
|
26
29
|
|
@@ -33,4 +36,5 @@ class Test_Person_Creation < Test::Unit::TestCase
|
|
33
36
|
end
|
34
37
|
assert_equal(100 , persons.size , "Both arrays should contain 100 elements ")
|
35
38
|
end
|
39
|
+
|
36
40
|
end
|
metadata
CHANGED
@@ -1,35 +1,28 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: faux_data
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 1.1.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Chris Stansbury
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-07-08 00:00:00 -05:00
|
19
|
-
default_executable:
|
12
|
+
date: 2013-05-26 00:00:00.000000000 Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
|
-
|
14
|
+
description: FauxData was created to quickly generate random employee demographic
|
15
|
+
data which is used for demostrating your application and application's reporting
|
16
|
+
features. Address data is pulled from US Census records, keeping the US city, US
|
17
|
+
state, and US zip code in sync, while street names are randomly pulled.
|
23
18
|
email: Chris@koozie.org
|
24
19
|
executables: []
|
25
|
-
|
26
20
|
extensions: []
|
27
|
-
|
28
21
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
22
|
+
files:
|
31
23
|
- Rakefile
|
32
24
|
- lib/faux_data/address_generator.rb
|
25
|
+
- lib/faux_data/compatibility.rb
|
33
26
|
- lib/faux_data/data/us/city_state_zipcode.txt
|
34
27
|
- lib/faux_data/data/us/female_given_names.txt
|
35
28
|
- lib/faux_data/data/us/male_given_names.txt
|
@@ -45,39 +38,28 @@ files:
|
|
45
38
|
- test/test_person.rb
|
46
39
|
- README.md
|
47
40
|
- LICENSE
|
48
|
-
has_rdoc: true
|
49
41
|
homepage: https://github.com/koozie/FauxData
|
50
42
|
licenses: []
|
51
|
-
|
52
43
|
post_install_message:
|
53
44
|
rdoc_options: []
|
54
|
-
|
55
|
-
require_paths:
|
45
|
+
require_paths:
|
56
46
|
- lib
|
57
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
48
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
|
64
|
-
- 0
|
65
|
-
version: "0"
|
66
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
54
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
75
59
|
requirements: []
|
76
|
-
|
77
60
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.8.24
|
79
62
|
signing_key:
|
80
63
|
specification_version: 3
|
81
64
|
summary: FauxData is a ruby library that creates faux employee, member or people data
|
82
65
|
test_files: []
|
83
|
-
|