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