forgery 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,10 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe Forgery::Name do
4
4
  it "should return a random first name" do
5
- (Forgery.dictionaries[:male_first_names] + Forgery.dictionaries[:female_first_names]).should include(Forgery::Name.first_name)
5
+ expect(Forgery.dictionaries[:male_first_names] + Forgery.dictionaries[:female_first_names]).to include(Forgery::Name.first_name)
6
6
  end
7
7
 
8
8
  it "should return a random last name" do
9
- Forgery.dictionaries[:last_names].should include(Forgery::Name.last_name)
9
+ expect(Forgery.dictionaries[:last_names]).to include(Forgery::Name.last_name)
10
10
  end
11
11
  end
@@ -3,13 +3,13 @@ require 'spec_helper'
3
3
  describe Forgery::Personal do
4
4
  describe '.gender' do
5
5
  it 'should return male or female' do
6
- Forgery.dictionaries[:genders].should include(Forgery::Personal.gender)
6
+ expect(Forgery.dictionaries[:genders]).to include(Forgery::Personal.gender)
7
7
  end
8
8
  end
9
9
 
10
10
  describe '.shirt_size' do
11
11
  it 'should return a sane size' do
12
- Forgery.dictionaries[:shirt_sizes].should include(Forgery::Personal.shirt_size)
12
+ expect(Forgery.dictionaries[:shirt_sizes]).to include(Forgery::Personal.shirt_size)
13
13
  end
14
14
  end
15
15
  end
@@ -3,31 +3,31 @@ require 'spec_helper'
3
3
  describe Forgery::RussianTax do
4
4
 
5
5
  it 'bik should be 9 symbols' do
6
- Forgery::RussianTax.bik.length.should eq 9
6
+ expect(Forgery::RussianTax.bik.length).to eq 9
7
7
  end
8
8
 
9
9
  it "bik should start with 04" do
10
- Forgery::RussianTax.bik[0,2].should eq '04'
10
+ expect(Forgery::RussianTax.bik[0,2]).to eq '04'
11
11
  end
12
12
 
13
13
  it "bik should have valid last part" do
14
- Forgery::RussianTax.bik[6,8].to_i.should be > 50
14
+ expect(Forgery::RussianTax.bik[6,8].to_i).to be > 50
15
15
  end
16
16
 
17
17
  it 'bik should be 20 symbols' do
18
- Forgery::RussianTax.account_number.length.should eq 20
18
+ expect(Forgery::RussianTax.account_number.length).to eq 20
19
19
  end
20
20
 
21
21
  context 'legal inn' do
22
22
  let(:inn) { Forgery::RussianTax.inn({ :type =>:legal }) }
23
23
 
24
24
  it 'legal inn should be 10 symbols' do
25
- inn.length.should eq 10
25
+ expect(inn.length).to eq 10
26
26
  end
27
27
 
28
28
  it 'leagl inn crc' do
29
29
  mask = [2, 4, 10, 3, 5, 9, 4, 6, 8]
30
- ((0..(inn.length-2)).inject(0) {|crc, i| crc + inn[i].to_i*mask[i].to_i} % 11 % 10).should eq inn[9].chr.to_i
30
+ expect((0..(inn.length-2)).inject(0) {|crc, i| crc + inn[i].to_i*mask[i].to_i} % 11 % 10).to eq inn[9].chr.to_i
31
31
  end
32
32
 
33
33
  end
@@ -36,17 +36,17 @@ describe Forgery::RussianTax do
36
36
  let(:inn) { Forgery::RussianTax.inn({ :type => :person }) }
37
37
 
38
38
  it 'person inn should be 12 symbols' do
39
- inn.length.should eq 12
39
+ expect(inn.length).to eq 12
40
40
  end
41
41
 
42
42
  it 'person inn crc 10' do
43
43
  mask = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
44
- ((0..(inn.length-3)).inject(0) {|crc, i| crc + inn[i].to_i*mask[i].to_i} % 11 % 10).should eq inn[10].chr.to_i
44
+ expect((0..(inn.length-3)).inject(0) {|crc, i| crc + inn[i].to_i*mask[i].to_i} % 11 % 10).to eq inn[10].chr.to_i
45
45
  end
46
46
 
47
47
  it 'person inn crc 11' do
48
48
  mask = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
49
- ((0..(inn.length-2)).inject(0) {|crc, i| crc + inn[i].to_i*mask[i].to_i} % 11 % 10).should eq inn[11].chr.to_i
49
+ expect((0..(inn.length-2)).inject(0) {|crc, i| crc + inn[i].to_i*mask[i].to_i} % 11 % 10).to eq inn[11].chr.to_i
50
50
  end
51
51
 
52
52
  end
@@ -55,11 +55,11 @@ describe Forgery::RussianTax do
55
55
  let(:ogrn) { Forgery::RussianTax.ogrn({ :type => :legal }) }
56
56
 
57
57
  it 'legal ogrn should be 13 symbols' do
58
- ogrn.length.should eq 13
58
+ expect(ogrn.length).to eq 13
59
59
  end
60
60
 
61
61
  it 'legal ogrn should have valid crc' do
62
- (ogrn[0..-2].to_i%11%10).should eq ogrn[-1].chr.to_i
62
+ expect(ogrn[0..-2].to_i%11%10).to eq ogrn[-1].chr.to_i
63
63
  end
64
64
  end
65
65
 
@@ -67,11 +67,11 @@ describe Forgery::RussianTax do
67
67
  let(:ogrn) { Forgery::RussianTax.ogrn({ :type => :person }) }
68
68
 
69
69
  it 'person ogrn should be 15 symbols' do
70
- ogrn.length.should eq 15
70
+ expect(ogrn.length).to eq 15
71
71
  end
72
72
 
73
73
  it 'person ogrn should have valid crc' do
74
- (ogrn[0..-2].to_i%13%10).should eq ogrn[-1].chr.to_i
74
+ expect(ogrn[0..-2].to_i%13%10).to eq ogrn[-1].chr.to_i
75
75
  end
76
76
  end
77
77
 
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Forgery::Time do
4
4
  it "should return a random timezone" do
5
- Forgery.dictionaries[:zones].should include(Forgery::Time.zone)
5
+ expect(Forgery.dictionaries[:zones]).to include(Forgery::Time.zone)
6
6
  end
7
7
  end
@@ -2,62 +2,62 @@ require 'spec_helper'
2
2
  require 'pathname'
3
3
 
4
4
  describe Forgery do
5
- it "should load a dictionary when it is requested" do
5
+ it 'should load a dictionary when it is requested' do
6
6
  Forgery.dictionaries.reset!
7
7
 
8
- Forgery.dictionaries.should_not be_loaded(:colors)
8
+ expect(Forgery.dictionaries).not_to be_loaded(:colors)
9
9
 
10
10
  Forgery.dictionaries[:colors]
11
11
 
12
- Forgery.dictionaries.should be_loaded(:colors)
12
+ expect(Forgery.dictionaries).to be_loaded(:colors)
13
13
  end
14
14
 
15
- it "should load formats when it is requested" do
15
+ it 'should load formats when it is requested' do
16
16
  Forgery.formats.reset!
17
17
 
18
- Forgery.formats.should_not be_loaded(:phone)
18
+ expect(Forgery.formats).not_to be_loaded(:phone)
19
19
 
20
20
  Forgery.formats[:phone]
21
21
 
22
- Forgery.formats.should be_loaded(:phone)
22
+ expect(Forgery.formats).to be_loaded(:phone)
23
23
  end
24
24
 
25
- it "should accept a symbol and return the appropriate forgery class" do
26
- Forgery(:address).should == Forgery::Address
27
- Forgery(:basic).should == Forgery::Basic
28
- Forgery(:internet).should == Forgery::Internet
25
+ it 'should accept a symbol and return the appropriate forgery class' do
26
+ expect(Forgery(:address)).to eq(Forgery::Address)
27
+ expect(Forgery(:basic)).to eq(Forgery::Basic)
28
+ expect(Forgery(:internet)).to eq(Forgery::Internet)
29
29
  end
30
30
 
31
- it "should accept two symbols, finding the right class and calling the appropriate method" do
32
- Forgery::Address.should_receive(:street_name)
31
+ it 'should accept two symbols, finding the right class and calling the appropriate method' do
32
+ expect(Forgery::Address).to receive(:street_name)
33
33
  Forgery(:address, :street_name)
34
34
 
35
- Forgery::Name.should_receive(:full_name)
35
+ expect(Forgery::Name).to receive(:full_name)
36
36
  Forgery(:name, :full_name)
37
37
  end
38
38
 
39
- it "should accept two symbols and arguments, passing them along to the appropriate method" do
40
- Forgery::LoremIpsum.should_receive(:text).with(:sentences, 2)
39
+ it 'should accept two symbols and arguments, passing them along to the appropriate method' do
40
+ expect(Forgery::LoremIpsum).to receive(:text).with(:sentences, 2)
41
41
  Forgery(:lorem_ipsum, :text, :sentences, 2)
42
42
  end
43
43
 
44
- it "should return the rails root path as a string if Rails.root is defined" do
44
+ it 'should return the rails root path as a string if Rails.root is defined' do
45
45
  Rails = Object.new
46
- Rails.stub!(:root).and_return(Pathname.new('/path/from/rails/dot/root'))
47
- Forgery.rails_root.should == '/path/from/rails/dot/root'
46
+ allow(Rails).to receive(:root).and_return(Pathname.new('/path/from/rails/dot/root'))
47
+ expect(Forgery.rails_root).to eq('/path/from/rails/dot/root')
48
48
  Object.instance_eval { remove_const(:Rails) }
49
49
  end
50
50
 
51
- it "should return nil when Rails.root and Rails.root are not defined" do
52
- Forgery.rails_root.should be_nil
51
+ it 'should return nil when Rails.root and Rails.root are not defined' do
52
+ expect(Forgery.rails_root).to be_nil
53
53
  end
54
54
 
55
- it "should not be a rails environment when there is not a rails_root" do
56
- Forgery.rails?.should be_false
55
+ it 'should not be a rails environment when there is not a rails_root' do
56
+ expect(Forgery.rails?).to be false
57
57
  end
58
58
 
59
- it "should be a rails environment when there is a rails_root" do
60
- Forgery.stub!(:rails?).and_return(true)
61
- Forgery.rails?.should be_true
59
+ it 'should be a rails environment when there is a rails_root' do
60
+ allow(Forgery).to receive(:rails?).and_return(true)
61
+ expect(Forgery.rails?).to be true
62
62
  end
63
63
  end
@@ -6,7 +6,7 @@ describe Forgery::Formats do
6
6
 
7
7
  formats[:phone]
8
8
 
9
- formats.should be_loaded(:phone)
9
+ expect(formats).to be_loaded(:phone)
10
10
  end
11
11
 
12
12
  it "should load a dictionary when called by the key" do
@@ -14,11 +14,11 @@ describe Forgery::Formats do
14
14
 
15
15
  formats.reset!
16
16
 
17
- formats.should_not be_loaded(:phone)
17
+ expect(formats).not_to be_loaded(:phone)
18
18
 
19
19
  formats[:phone]
20
20
 
21
- formats.should be_loaded(:phone)
21
+ expect(formats).to be_loaded(:phone)
22
22
  end
23
23
 
24
24
  it "should clear the loaded formats when calling reset!" do
@@ -26,10 +26,10 @@ describe Forgery::Formats do
26
26
 
27
27
  formats[:phone]
28
28
 
29
- formats.should be_loaded(:phone)
29
+ expect(formats).to be_loaded(:phone)
30
30
 
31
31
  formats.reset!
32
32
 
33
- formats.should_not be_loaded(:phone)
33
+ expect(formats).not_to be_loaded(:phone)
34
34
  end
35
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forgery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Sutton
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-20 00:00:00.000000000 Z
13
+ date: 2017-12-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '1.3'
21
+ version: 1.16.0
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '1.3'
28
+ version: 1.16.0
29
29
  description: Easy and customizable generation of forged data. Can be used as a gem
30
30
  or a rails plugin. Includes rails generators for creating your own forgeries.
31
31
  email:
@@ -48,6 +48,7 @@ files:
48
48
  - generators/forgery/forgery_generator.rb
49
49
  - lib/forgery.rb
50
50
  - lib/forgery/dictionaries.rb
51
+ - lib/forgery/dictionaries/bics
51
52
  - lib/forgery/dictionaries/cities
52
53
  - lib/forgery/dictionaries/colors
53
54
  - lib/forgery/dictionaries/company_names
@@ -59,6 +60,7 @@ files:
59
60
  - lib/forgery/dictionaries/female_first_names
60
61
  - lib/forgery/dictionaries/frequencies
61
62
  - lib/forgery/dictionaries/genders
63
+ - lib/forgery/dictionaries/ibans
62
64
  - lib/forgery/dictionaries/industries
63
65
  - lib/forgery/dictionaries/job_title_suffixes
64
66
  - lib/forgery/dictionaries/job_titles
@@ -86,6 +88,7 @@ files:
86
88
  - lib/forgery/file_reader.rb
87
89
  - lib/forgery/forgery.rb
88
90
  - lib/forgery/forgery/address.rb
91
+ - lib/forgery/forgery/bank_account.rb
89
92
  - lib/forgery/forgery/basic.rb
90
93
  - lib/forgery/forgery/credit_card.rb
91
94
  - lib/forgery/forgery/currency.rb
@@ -117,6 +120,7 @@ files:
117
120
  - spec/extensions/string_spec.rb
118
121
  - spec/file_reader_spec.rb
119
122
  - spec/forgery/address_spec.rb
123
+ - spec/forgery/bank_account_spec.rb
120
124
  - spec/forgery/basic_spec.rb
121
125
  - spec/forgery/credit_card_spec.rb
122
126
  - spec/forgery/currency_spec.rb
@@ -150,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
154
  version: 1.3.6
151
155
  requirements: []
152
156
  rubyforge_project: forgery
153
- rubygems_version: 2.2.2
157
+ rubygems_version: 2.6.13
154
158
  signing_key:
155
159
  specification_version: 4
156
160
  summary: Easy and customizable generation of forged data.
@@ -165,6 +169,7 @@ test_files:
165
169
  - spec/extensions/string_spec.rb
166
170
  - spec/file_reader_spec.rb
167
171
  - spec/forgery/address_spec.rb
172
+ - spec/forgery/bank_account_spec.rb
168
173
  - spec/forgery/basic_spec.rb
169
174
  - spec/forgery/credit_card_spec.rb
170
175
  - spec/forgery/currency_spec.rb