codice-fiscale 0.0.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,11 +9,11 @@ describe CodiceFiscale::ItalianCitizen do
9
9
 
10
10
  describe '#initialize' do
11
11
  it 'accepts 1 attribute' do
12
- lambda { marco }.should_not raise_error
12
+ expect { marco }.not_to raise_error
13
13
  end
14
14
 
15
15
  it 'do not accepts 0 attribute' do
16
- lambda { described_class.new }.should raise_error(ArgumentError)
16
+ expect { described_class.new }.to raise_error(ArgumentError)
17
17
  end
18
18
  end
19
19
 
@@ -21,8 +21,8 @@ describe CodiceFiscale::ItalianCitizen do
21
21
  describe '#validations' do
22
22
  describe 'when all attributes are valid' do
23
23
  it 'is valid' do
24
- marco.should be_valid
25
- john.should be_valid
24
+ expect(marco).to be_valid
25
+ expect(john).to be_valid
26
26
  end
27
27
  end
28
28
 
@@ -31,7 +31,7 @@ describe CodiceFiscale::ItalianCitizen do
31
31
 
32
32
  it 'is not valid' do
33
33
  citizen_without_name.valid?
34
- citizen_without_name.errors[:name].should_not be_empty
34
+ expect(citizen_without_name.errors[:name]).not_to be_empty
35
35
  end
36
36
  end
37
37
 
@@ -40,7 +40,7 @@ describe CodiceFiscale::ItalianCitizen do
40
40
 
41
41
  it 'is not valid' do
42
42
  citizen_with_strange_gender.valid?
43
- citizen_with_strange_gender.errors[:gender].should_not be_empty
43
+ expect(citizen_with_strange_gender.errors[:gender]).not_to be_empty
44
44
  end
45
45
  end
46
46
 
@@ -49,7 +49,7 @@ describe CodiceFiscale::ItalianCitizen do
49
49
 
50
50
  it 'is not valid' do
51
51
  citizen_with_invalid_province.valid?
52
- citizen_with_invalid_province.errors[:province_code].should_not be_empty
52
+ expect(citizen_with_invalid_province.errors[:province_code]).not_to be_empty
53
53
  end
54
54
  end
55
55
 
@@ -58,7 +58,7 @@ describe CodiceFiscale::ItalianCitizen do
58
58
 
59
59
  it 'is not valid' do
60
60
  citizen_with_invalid_date.valid?
61
- citizen_with_invalid_date.errors[:birthdate].should_not be_empty
61
+ expect(citizen_with_invalid_date.errors[:birthdate]).not_to be_empty
62
62
  end
63
63
  end
64
64
  end
@@ -1,25 +1,34 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe CodiceFiscale do
4
5
  describe '#calculate' do
5
- let(:mario_attributes) { {:name => 'mario', :surname => 'rossi', :gender => :male, :birthdate => Date.new(1987, 1, 1),
6
- :province_code => 'lc', :city_name => 'Abbadia Lariana'} }
7
-
8
6
  before do
9
7
  subject.config.city_code = nil
10
8
  subject.config.country_code = nil
11
9
  end
12
10
 
13
11
  it 'returns the expected code' do
14
- subject.calculate(mario_attributes).should == 'RSSMRA87A01A005V'
12
+ # Please note that the following are completely made-up data
13
+ [
14
+ [{:name => 'mario', :surname => 'rossi', :gender => :male, :birthdate => Date.new(1987, 1, 1), :province_code => 'lc', :city_name => 'Abbadia Lariana'}, "RSSMRA87A01A005V"],
15
+ [{:name => "Marco", :surname => "Rossi", :gender => :male, :birthdate => Date.new(1983, 5, 3), :city_name => "Oggiono", :province_code => "LC"}, "RSSMRC83E03G009W"],
16
+ [{:name => "John", :surname => "Smith", :gender => :male, :birthdate => Date.new(1988, 5, 3), :country_name => "Francia"}, "SMTJHN88E03Z110R"],
17
+ [{:name => "John", :surname => "Smith", :gender => :male, :birthdate => Date.new(1988, 5, 3), :country_name => "France"}, "SMTJHN88E03Z110R"],
18
+ [{:name => "John", :surname => "Smith", :gender => :male, :birthdate => Date.new(1988, 5, 3), :country_name => "Sao Tomé e Principe"}, "SMTJHN88E03Z341A"],
19
+ [{:name => "Marco", :surname => "Rossi", :gender => :male, :birthdate => Date.new(1983, 5, 3), :city_name => "Forlì", :province_code =>"FC"}, "RSSMRC83E03D704X"],
20
+ ].each do |row|
21
+ params, expected_code = row[0], row[1]
22
+ expect(subject.calculate(params)).to eq expected_code
23
+ end
15
24
  end
16
25
 
17
26
  context 'when params are not valid' do
18
- let(:invalid_attributes) { mario_attributes.merge(:name => '') }
27
+ let(:invalid_attributes) { {:name => ''} }
19
28
 
20
29
  it 'raises an error' do
21
- lambda { subject.calculate(invalid_attributes) }.should raise_error(ArgumentError)
30
+ expect { subject.calculate(invalid_attributes) }.to raise_error(ArgumentError)
22
31
  end
23
32
  end
24
33
  end
25
- end
34
+ end
@@ -3,5 +3,3 @@ def fixtures_path
3
3
  end
4
4
 
5
5
  require File.expand_path '../../lib/codice_fiscale', __FILE__
6
-
7
-
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codice-fiscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - topac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-22 00:00:00.000000000 Z
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: guard-rspec
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,33 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rb-fsevent
42
+ name: guard-rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.9.1
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.9.1
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: growl
56
+ name: rb-fsevent
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.9.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.9.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: Calculate the italian fiscal code
97
+ description: Calculate the Italian Tax ID (Codice Fiscale)
98
98
  email:
99
99
  - dani.m.mobile@gmail.com
100
100
  executables: []
@@ -102,6 +102,7 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
+ - ".travis.yml"
105
106
  - Gemfile
106
107
  - Guardfile
107
108
  - LICENSE
@@ -118,16 +119,13 @@ files:
118
119
  - lib/codice_fiscale/helpers.rb
119
120
  - lib/codice_fiscale/italian_citizen.rb
120
121
  - lib/codice_fiscale/version.rb
121
- - spec/fixtures/city_codes.csv
122
- - spec/fixtures/country_codes.csv
123
122
  - spec/lib/codice_fiscale/alphabet_spec.rb
124
123
  - spec/lib/codice_fiscale/codes_spec.rb
125
124
  - spec/lib/codice_fiscale/fiscal_code_spec.rb
126
- - spec/lib/codice_fiscale/helpers_spec.rb
127
125
  - spec/lib/codice_fiscale/italian_citizen_spec.rb
128
126
  - spec/lib/codice_fiscale_spec.rb
129
127
  - spec/spec_helper.rb
130
- homepage: https://github.com/daniele-m/codice_fiscale
128
+ homepage: https://github.com/topac/codice_fiscale
131
129
  licenses: []
132
130
  metadata: {}
133
131
  post_install_message:
@@ -145,18 +143,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
143
  - !ruby/object:Gem::Version
146
144
  version: '0'
147
145
  requirements: []
148
- rubyforge_project:
149
- rubygems_version: 2.6.12
146
+ rubygems_version: 3.0.3
150
147
  signing_key:
151
148
  specification_version: 4
152
- summary: Calculate the italian fiscal code
149
+ summary: Calculate the Italian Tax ID (Codice Fiscale)
153
150
  test_files:
154
- - spec/fixtures/city_codes.csv
155
- - spec/fixtures/country_codes.csv
156
151
  - spec/lib/codice_fiscale/alphabet_spec.rb
157
152
  - spec/lib/codice_fiscale/codes_spec.rb
158
153
  - spec/lib/codice_fiscale/fiscal_code_spec.rb
159
- - spec/lib/codice_fiscale/helpers_spec.rb
160
154
  - spec/lib/codice_fiscale/italian_citizen_spec.rb
161
155
  - spec/lib/codice_fiscale_spec.rb
162
156
  - spec/spec_helper.rb
@@ -1 +0,0 @@
1
- CODICE NAZIONALE,CODICE CATASTALE BELFIORE aggiornato al 1/9/1999 ora non pi in uso,PROVINCIA,DENOMINAZIONE COMUNE,ANNOTAZIONE,VARIAZIONE CODICE NAZAZIONALE,VARIAZIONE CODICE CATASTALE,VARIAZIONE PROVINCIA,VARIAZIONE DENOMINAZIONE DEL COMUNE,DATA COSTITUZIONE,DATA VARIAZIONE
@@ -1 +0,0 @@
1
- CONTIN,SIGLA,DENOMINAZ,CODICE,DATAIST,DATASOP,CODRIF,DATAVARIAZ
@@ -1,4 +0,0 @@
1
- require 'spec_helper'
2
-
3
-
4
- #TODO