forgery 0.4.3 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +12 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +35 -0
- data/LICENSE +1 -1
- data/README.markdown +196 -60
- data/Rakefile +10 -54
- data/forgery.gemspec +23 -0
- data/lib/forgery.rb +0 -1
- data/lib/forgery/dictionaries/bics +7 -0
- data/lib/forgery/dictionaries/company_names +0 -1
- data/lib/forgery/dictionaries/currency_descriptions +2 -2
- data/lib/forgery/dictionaries/ibans +61 -0
- data/lib/forgery/dictionaries/job_titles +1 -1
- data/lib/forgery/dictionaries/zones +1 -2
- data/lib/forgery/extend.rb +0 -2
- data/lib/forgery/extensions/range.rb +1 -1
- data/lib/forgery/file_reader.rb +2 -1
- data/lib/forgery/forgery/bank_account.rb +25 -0
- data/lib/forgery/forgery/basic.rb +1 -1
- data/lib/forgery/forgery/credit_card.rb +71 -0
- data/lib/forgery/forgery/geo.rb +54 -0
- data/lib/forgery/forgery/internet.rb +7 -0
- data/lib/forgery/forgery/lorem_ipsum.rb +4 -4
- data/lib/forgery/forgery/russian_tax.rb +57 -0
- data/lib/forgery/forgery_railtie.rb +0 -29
- data/lib/forgery/formats/phone +1 -1
- data/lib/forgery/version.rb +3 -1
- data/spec/data/dictionaries/code_names +6 -0
- data/spec/data/dictionaries/female_first_names +1 -0
- data/spec/data/documents/mock_web_page.html +17 -0
- data/spec/data/documents/mock_xml_doc.xml +5 -0
- data/spec/dictionaries_spec.rb +35 -0
- data/spec/extensions/array_spec.rb +25 -0
- data/spec/extensions/range_spec.rb +33 -0
- data/spec/extensions/string_spec.rb +29 -0
- data/spec/file_reader_spec.rb +32 -0
- data/spec/forgery/address_spec.rb +84 -0
- data/spec/forgery/bank_account_spec.rb +16 -0
- data/spec/forgery/basic_spec.rb +179 -0
- data/spec/forgery/credit_card_spec.rb +68 -0
- data/spec/forgery/currency_spec.rb +15 -0
- data/spec/forgery/date_spec.rb +134 -0
- data/spec/forgery/internet_spec.rb +62 -0
- data/spec/forgery/lorem_ipsum_spec.rb +132 -0
- data/spec/forgery/monetary_spec.rb +14 -0
- data/spec/forgery/name_spec.rb +11 -0
- data/spec/forgery/personal_spec.rb +15 -0
- data/spec/forgery/russian_tax_spec.rb +81 -0
- data/spec/forgery/time_spec.rb +7 -0
- data/spec/forgery_spec.rb +63 -0
- data/spec/formats_spec.rb +35 -0
- data/spec/spec_helper.rb +39 -0
- metadata +89 -38
- data/lib/forgery/file_writer.rb +0 -54
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forgery::CreditCard do
|
4
|
+
describe ".number" do
|
5
|
+
# basics
|
6
|
+
it "should be valid (pass a Luhn test)" do
|
7
|
+
expect(valid_number?(Forgery::CreditCard.number)).to eql(true)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should start with a valid prefix" do
|
11
|
+
expect(which_type?(Forgery::CreditCard.number)).not_to eql(false)
|
12
|
+
end
|
13
|
+
|
14
|
+
# type specified
|
15
|
+
it "should be valid if type specified" do
|
16
|
+
expect(valid_number?(Forgery::CreditCard.number :type => 'Discover')).to eql(true)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should start with a valid prefix for type specified" do
|
20
|
+
expect(which_type?(Forgery::CreditCard.number :type => 'MasterCard')).to eql(:master)
|
21
|
+
end
|
22
|
+
|
23
|
+
# type and length specified
|
24
|
+
it "should be valid if type and length specified" do
|
25
|
+
expect(valid_number?(Forgery::CreditCard.number :type => 'Visa', :length => 13)).to eql(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be the length specified" do
|
29
|
+
expect((Forgery::CreditCard.number :type => 'Visa', :length => 13).length).to eql(13)
|
30
|
+
end
|
31
|
+
|
32
|
+
# length and prefixes specified
|
33
|
+
it "should be valid if length and prefixes specified" do
|
34
|
+
expect(valid_number?(Forgery::CreditCard.number :length => 14, :prefixes => %w"300 301 302 303 36 38")).to eql(true)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should be a valid Diners Club card, since its length and prefixes are specified" do
|
38
|
+
expect(which_type?(Forgery::CreditCard.number :length => 14, :prefixes => %w"300 301 302 303 36 38")).to eql(:diners)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe ".type" do
|
43
|
+
it "should return a valid type" do
|
44
|
+
expect(which_type?(Forgery::CreditCard.number :type => Forgery::CreditCard.type)).not_to eql(false)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# helper functions below originally from: https://gist.github.com/1182499
|
49
|
+
def valid_number?(number)
|
50
|
+
number.reverse!
|
51
|
+
relative_number = {'0' => 0, '1' => 2, '2' => 4, '3' => 6, '4' => 8, '5' => 1, '6' => 3, '7' => 5, '8' => 7, '9' => 9}
|
52
|
+
sum = 0
|
53
|
+
number.split("").each_with_index do |n, i|
|
54
|
+
sum += (i % 2 == 0) ? n.to_i : relative_number[n]
|
55
|
+
end
|
56
|
+
sum % 10 == 0
|
57
|
+
end
|
58
|
+
|
59
|
+
def which_type?(number)
|
60
|
+
return :diners if number.length == 14 && number =~ /^3(0[0-5]|[68])/ # 300xxx-305xxx, 36xxxx, 38xxxx
|
61
|
+
return :amex if number.length == 15 && number =~ /^3[47]/ # 34xxxx, 37xxxx
|
62
|
+
return :visa if [13,16].include?(number.length) && number =~ /^4/ # 4xxxxx
|
63
|
+
return :master if number.length == 16 && number =~ /^5[1-5]/ # 51xxxx-55xxxx
|
64
|
+
return :discover if number.length == 16 && number =~ /^6011/ # 6011xx
|
65
|
+
return false
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forgery::Currency do
|
4
|
+
describe ".currency_descriptions" do
|
5
|
+
it "should be able to generate a currency description" do
|
6
|
+
expect(Forgery::Currency.description).not_to eql(nil)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".currency_codes" do
|
11
|
+
it "should have the same output when encrypting twice" do
|
12
|
+
expect(Forgery::Currency.code).not_to eql(nil)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
describe Forgery::Date do
|
5
|
+
describe '.day_of_week' do
|
6
|
+
it 'should return a day of the week' do
|
7
|
+
expect(Date::DAYNAMES).to include(Forgery::Date.day_of_week)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '.day_of_week(:abbr => true)' do
|
12
|
+
it 'should return a day of the week in abbreviated form' do
|
13
|
+
expect(Date::ABBR_DAYNAMES).to include(Forgery::Date.day_of_week(:abbr => true))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.month' do
|
18
|
+
it 'should return a valid month' do
|
19
|
+
expect(Date::MONTHNAMES).to include(Forgery::Date.month)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.month(:abbr => true)' do
|
24
|
+
it 'should return a valid month in abbreviated form' do
|
25
|
+
expect(Date::ABBR_MONTHNAMES).to include(Forgery::Date.month(:abbr => true))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '.month(:numerical => true)' do
|
30
|
+
it 'should return a valid month in numeric form' do
|
31
|
+
expect([1,2,3,4,5,6,7,8,9,10,11,12]).to include(Forgery::Date.month(:numerical => true))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '.year' do
|
36
|
+
it 'should return a valid year within 20 years of the current year' do
|
37
|
+
year = Forgery::Date.year
|
38
|
+
expect(year).to be > Date.today.year - 21
|
39
|
+
expect(year).to be < Date.today.year + 21
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '.year(:future => true)' do
|
44
|
+
it 'should return a year greater than the current one' do
|
45
|
+
year = Forgery::Date.year(:future => true)
|
46
|
+
expect(year).to be >= Date.today.year
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '.year(:min_delta => 5, :max_delta => 5, :future => true)' do
|
51
|
+
it 'should return a year 5 years from the current one' do
|
52
|
+
year = Forgery::Date.year(:min_delta => 5, :max_delta => 5, :future => true)
|
53
|
+
expect(year).to eq(Date.today.year + 5)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '.year(:min_delta => 5, :max_delta => 10, :future => true)' do
|
58
|
+
it 'should return a year that is between 5 and 10 years greater than the current one' do
|
59
|
+
year = Forgery::Date.year(:min_delta => 5, :max_delta => 10, :future => true)
|
60
|
+
expect((0..5).map { |i| Date.today.year + i + 5 }).to include(year)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '.year(:past => true)' do
|
65
|
+
it 'should return a year less than the current one' do
|
66
|
+
year = Forgery::Date.year(:past => true)
|
67
|
+
expect(year).to be <= Date.today.year
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '.year(:min_delta => 5, :max_delta => 5, :past => true)' do
|
72
|
+
it 'should return a year 5 years until the current one' do
|
73
|
+
year = Forgery::Date.year(:min_delta => 5, :max_delta => 5, :past => true)
|
74
|
+
expect(year).to eq(Date.today.year - 5)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '.year(:min_delta => 5, :max_delta => 10, :past => true)' do
|
79
|
+
it 'should return a year that is between 5 and 10 years less than the current one' do
|
80
|
+
year = Forgery::Date.year(:min_delta => 5, :max_delta => 10, :past => true)
|
81
|
+
expect((0..5).map { |i| Date.today.year - i - 5 }).to include(year)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '.date' do
|
86
|
+
it 'should return a valid date within 7300 days of the current date' do
|
87
|
+
date = Forgery::Date.date
|
88
|
+
expect(date).to be > Date.today - 7300
|
89
|
+
expect(date).to be < Date.today + 7300
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '.date(:future => true)' do
|
94
|
+
it 'should return a date greater than the current one' do
|
95
|
+
date = Forgery::Date.date(:future => true)
|
96
|
+
expect(date).to be >= Date.today
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe '.date(:min_delta => 5, :max_delta => 5, :future => true)' do
|
101
|
+
it 'should return a date 5 days from the current one' do
|
102
|
+
date = Forgery::Date.date(:min_delta => 5, :max_delta => 5, :future => true)
|
103
|
+
expect(date).to eq(Date.today + 5)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe '.date(:min_delta => 5, :max_delta => 10, :future => true)' do
|
108
|
+
it 'should return a date that is between 5 and 10 days greater than the current one' do
|
109
|
+
date = Forgery::Date.date(:min_delta => 5, :max_delta => 10, :future => true)
|
110
|
+
expect((0..5).map { |i| Date.today + i + 5 }).to include(date)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe '.date(:past => true)' do
|
115
|
+
it 'should return a date less than the current one' do
|
116
|
+
date = Forgery::Date.date(:past => true)
|
117
|
+
expect(date).to be <= Date.today
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '.date(:min_delta => 5, :max_delta => 5, :past => true)' do
|
122
|
+
it 'should return a date 5 days until the current one' do
|
123
|
+
date = Forgery::Date.date(:min_delta => 5, :max_delta => 5, :past => true)
|
124
|
+
expect(date).to eq(Date.today - 5)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '.date(:min_delta => 5, :max_delta => 10, :past => true)' do
|
129
|
+
it 'should return a date that is between 5 and 10 days less than the current one' do
|
130
|
+
date = Forgery::Date.date(:min_delta => 5, :max_delta => 10, :past => true)
|
131
|
+
expect((0..5).map { |i| Date.today - i - 5 }).to include(date)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forgery::Internet do
|
4
|
+
describe ".user_name" do
|
5
|
+
it "should return a username that is lowercase" do
|
6
|
+
expect(Forgery::Internet.user_name).to only_contain(Forgery::Basic::LOWER_ALPHA)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return a top level domain" do
|
11
|
+
expect(Forgery.dictionaries[:top_level_domains]).to include(Forgery::Internet.top_level_domain)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".domain_name" do
|
15
|
+
it "should return a domain name that contains a lowercase company name" do
|
16
|
+
downcase_company_name = Forgery::Internet.domain_name.split('.').first
|
17
|
+
Forgery.dictionaries[:company_names].any?{ |cn| cn =~ /#{downcase_company_name}/i }
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return a domain name that contains a top level domain" do
|
21
|
+
expect(Forgery.dictionaries[:top_level_domains]).to include(Forgery::Internet.domain_name.split('.').last)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe ".email_address" do
|
26
|
+
it "should match the email format" do
|
27
|
+
expect(Forgery::Internet.email_address).to match(/.+@.+\.(#{Forgery.dictionaries[:top_level_domains].join("|")})/)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe ".cctld" do
|
32
|
+
it "should return a country-code top level domain" do
|
33
|
+
expect(Forgery.dictionaries[:country_code_top_level_domains]).to include(Forgery::Internet.cctld)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the cctld in correct two-letter format" do
|
37
|
+
expect(Forgery::Internet.cctld).to match(/\A[a-z]{2}\Z/)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '.ip_v4' do
|
42
|
+
it 'should be 4 integers between 0 and 255 seprated by "."' do
|
43
|
+
val = Forgery::Internet.ip_v4
|
44
|
+
nums = val.split('.')
|
45
|
+
expect(nums.size).to eq(4)
|
46
|
+
nums.each do |num|
|
47
|
+
expect(num).to match(/\d{1,3}/)
|
48
|
+
expect(num.to_i).to be <= 255
|
49
|
+
expect(num.to_i).to be >= 0
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '.ip_v6' do
|
55
|
+
it 'should be a valid ipv6 address' do
|
56
|
+
val = Forgery::Internet.ip_v6
|
57
|
+
address = IPAddr.new(val)
|
58
|
+
expect(address.ipv6?).to eq(true)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forgery::LoremIpsum do
|
4
|
+
describe ".paragraphs" do
|
5
|
+
it "should return text" do
|
6
|
+
expect(Forgery::LoremIpsum.paragraphs).to be_a_kind_of(String)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should return text with 1 or more character" do
|
10
|
+
expect(Forgery::LoremIpsum.paragraphs.size).to be >= 1
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should default to returning 2 paragraphs separated by \\n\\n" do
|
14
|
+
expect(Forgery::LoremIpsum.paragraphs.split("\n\n").size).to eq(2)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should default to returning 3 sentences per paragraph" do
|
18
|
+
paragraphs = Forgery::LoremIpsum.paragraphs.split("\n\n")
|
19
|
+
paragraphs.each do |paragraph|
|
20
|
+
expect(paragraph.scan(".").size).to eq(3)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should wrap paragraphs in html paragraph tags when the :html option is true" do
|
25
|
+
paragraphs = Forgery::LoremIpsum.paragraphs(2, :html => true).split("\n\n")
|
26
|
+
paragraphs.each do |paragraph|
|
27
|
+
expect(paragraph).to match(/<p>.+?<\/p>/)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should wrap paragraphs in specified wrapping text" do
|
32
|
+
paragraphs = Forgery::LoremIpsum.paragraphs(2, :wrap => {:start => "foo", :end => "bar"}).split("\n\n")
|
33
|
+
paragraphs.each do |paragraph|
|
34
|
+
expect(paragraph).to match(/foo.+bar/)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should separate paragraphs with the specified string" do
|
39
|
+
expect(Forgery::LoremIpsum.paragraphs(2, :separator => "foo").split("foo").size).to eq(2)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".paragraph" do
|
44
|
+
it "should return text" do
|
45
|
+
expect(Forgery::LoremIpsum.paragraph).to be_a_kind_of(String)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return text with 1 or more character" do
|
49
|
+
expect(Forgery::LoremIpsum.paragraph.size).to be >= 1
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return a single paragraph" do
|
53
|
+
expect(Forgery::LoremIpsum.paragraph.scan("\n\n").size).to eq(0)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe ".sentences" do
|
58
|
+
it "should return text" do
|
59
|
+
expect(Forgery::LoremIpsum.sentences).to be_a_kind_of(String)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should return text with 1 or more character" do
|
63
|
+
expect(Forgery::LoremIpsum.sentences.size).to be >= 1
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should return two sentences by default" do
|
67
|
+
expect(Forgery::LoremIpsum.sentences.scan(".").size).to eq(2)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should return as many sentences as you specify" do
|
71
|
+
expect(Forgery::LoremIpsum.sentences(4).scan(".").size).to eq(4)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe ".sentence" do
|
76
|
+
it "should return text" do
|
77
|
+
expect(Forgery::LoremIpsum.sentence).to be_a_kind_of(String)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return text with 1 or more character" do
|
81
|
+
expect(Forgery::LoremIpsum.sentence.size).to be >= 1
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should return a single sentence" do
|
85
|
+
expect(Forgery::LoremIpsum.sentence.scan(".").size).to eq(1)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe ".words" do
|
90
|
+
it "should return text" do
|
91
|
+
expect(Forgery::LoremIpsum.words).to be_a_kind_of(String)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should return text with 1 or more character" do
|
95
|
+
expect(Forgery::LoremIpsum.words.size).to be >= 1
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should return a random set of words" do
|
99
|
+
Forgery::LoremIpsum.words(2, :random => true)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe ".word" do
|
104
|
+
it "should return text" do
|
105
|
+
expect(Forgery::LoremIpsum.word).to be_a_kind_of(String)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should return text with 1 or more character" do
|
109
|
+
expect(Forgery::LoremIpsum.word.size).to be >= 1
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe ".characters" do
|
114
|
+
it "should return text" do
|
115
|
+
expect(Forgery::LoremIpsum.characters).to be_a_kind_of(String)
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should return text with 1 or more character" do
|
119
|
+
expect(Forgery::LoremIpsum.characters.size).to be >= 1
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe ".character" do
|
124
|
+
it "should return text" do
|
125
|
+
expect(Forgery::LoremIpsum.character).to be_a_kind_of(String)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should return text with 1 or more character" do
|
129
|
+
expect(Forgery::LoremIpsum.character.size).to be >= 1
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'bigdecimal'
|
5
|
+
|
6
|
+
describe Forgery::Monetary do
|
7
|
+
it 'should return random number string' do
|
8
|
+
expect(Forgery(:monetary).money).to match(/^[\d+\.]+$/)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should return random number respecting min and max parameters' do
|
12
|
+
expect(BigDecimal(Forgery(:monetary).money({ min: 10, max: 20 }))).to be_between(10, 20)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forgery::Name do
|
4
|
+
it "should return a random first name" do
|
5
|
+
expect(Forgery.dictionaries[:male_first_names] + Forgery.dictionaries[:female_first_names]).to include(Forgery::Name.first_name)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return a random last name" do
|
9
|
+
expect(Forgery.dictionaries[:last_names]).to include(Forgery::Name.last_name)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forgery::Personal do
|
4
|
+
describe '.gender' do
|
5
|
+
it 'should return male or female' do
|
6
|
+
expect(Forgery.dictionaries[:genders]).to include(Forgery::Personal.gender)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.shirt_size' do
|
11
|
+
it 'should return a sane size' do
|
12
|
+
expect(Forgery.dictionaries[:shirt_sizes]).to include(Forgery::Personal.shirt_size)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|