uy-rut 0.0.1 → 0.0.2

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a62b6e354b8d1c3357778b8d48cc955218fe957
4
+ data.tar.gz: 26d895b370c97dc49d3e6ddf2c4a5bf8ffe87fc2
5
+ SHA512:
6
+ metadata.gz: 8c5557c9f69e86f20aa4709013cd5b00318274fc6a55981cd9b1e62ab8bc7a4221ed7413ff90773b68e1385f971cef004570d19f3286cbc294f4263cbbf207a6
7
+ data.tar.gz: b08754bcc789d72674eaa58cad366eff3cf8828c0d0e781d7356e1a6d1545e5da334810c01398d1a08ac7bd9ece60936ee60b9d8525037153722b35199cc76d7
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Uy::Rut
2
2
 
3
+ <a href="http://www.omniref.com/ruby/gems/uy-rut"><img src="http://assets2.omniref.com/assets/logo-1e25ba89780a42da4556dd96c03ac954.png" height="18" width="75"></a>
4
+
3
5
  This gem includes the necessary helper methods to validate Uruguayan company identification numbers ("Registro Único Tributario" or RUT).
4
6
 
5
7
  ## Installation
@@ -33,3 +35,7 @@ Uy::Rut.new.rut
33
35
  ## Contributing
34
36
 
35
37
  If you want to contribute to this project, just fork it, make your changes, run the tests and create a pull request. Also, feel free to report issues on the [issues section](issues).
38
+
39
+ ## Credits
40
+
41
+ Thanks to @cschmeichel for facilitating the algorithms!
data/lib/uy/rut.rb CHANGED
@@ -11,7 +11,6 @@ module Uy
11
11
  def is_valid?
12
12
  return false unless @rut =~ /\d{12}/
13
13
  return false unless (1..21) === @rut[0..1].to_i
14
- (2..7).each {|pos| return false unless (1..9) === @rut[pos].to_i}
15
14
  return false unless @rut[8..9] == '00'
16
15
 
17
16
  begin
data/spec/rut_spec.rb CHANGED
@@ -2,19 +2,15 @@ require 'uy/rut'
2
2
 
3
3
  describe Uy::Rut do
4
4
  describe 'validations' do
5
- it { expect(Uy::Rut.new('')).not_to be_valid }
6
- it { expect(Uy::Rut.new('asdf')).not_to be_valid }
7
- it { expect(Uy::Rut.new('11222222008')).not_to be_valid }
8
- it { expect(Uy::Rut.new('873332220087')).not_to be_valid }
9
- it { expect(Uy::Rut.new('010111110022')).not_to be_valid }
10
- it { expect(Uy::Rut.new('011011110029')).not_to be_valid }
11
- it { expect(Uy::Rut.new('011101110028')).not_to be_valid }
12
- it { expect(Uy::Rut.new('011110110027')).not_to be_valid }
13
- it { expect(Uy::Rut.new('011111010026')).not_to be_valid }
14
- it { expect(Uy::Rut.new('011111100025')).not_to be_valid }
15
- it { expect(Uy::Rut.new('024445558811')).not_to be_valid }
16
- it { expect(Uy::Rut.new('035557770088')).not_to be_valid }
17
- it { expect(Uy::Rut.new('219223180010')).to be_valid }
5
+ it { expect(Uy::Rut.new('')).not_to be_valid } # Empty
6
+ it { expect(Uy::Rut.new('asdf')).not_to be_valid } # Non digits, wrong length
7
+ it { expect(Uy::Rut.new('11222222008')).not_to be_valid } # Wrong length
8
+ it { expect(Uy::Rut.new('asdfasdfasdf')).not_to be_valid } # Non digits
9
+ it { expect(Uy::Rut.new('873332220087')).not_to be_valid } # Two first digits need to be in 1..21
10
+ it { expect(Uy::Rut.new('024445558811')).not_to be_valid } # Digits 8 and 9 need to be 0
11
+ it { expect(Uy::Rut.new('035557770088')).not_to be_valid } # Invalid check digit
12
+ it { expect(Uy::Rut.new('211003420017')).to be_valid } # Antel
13
+ it { expect(Uy::Rut.new('211406340011')).to be_valid } # Movistar
18
14
  end
19
15
 
20
16
  describe 'generation' do
data/uy-rut.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "uy-rut"
7
- spec.version = '0.0.1'
7
+ spec.version = '0.0.2'
8
8
  spec.authors = ["Alfonso Cora"]
9
9
  spec.email = ["acora6@gmail.com"]
10
10
  spec.description = %q{Includes helper methods to validate Uruguayan company identification numbers (RUT)}
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uy-rut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alfonso Cora
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2014-05-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,17 +41,15 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: Includes helper methods to validate Uruguayan company identification
@@ -80,29 +73,27 @@ files:
80
73
  homepage: ''
81
74
  licenses:
82
75
  - MIT
76
+ metadata: {}
83
77
  post_install_message:
84
78
  rdoc_options: []
85
79
  require_paths:
86
80
  - lib
87
81
  required_ruby_version: !ruby/object:Gem::Requirement
88
- none: false
89
82
  requirements:
90
- - - ! '>='
83
+ - - '>='
91
84
  - !ruby/object:Gem::Version
92
85
  version: '0'
93
86
  required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
87
  requirements:
96
- - - ! '>='
88
+ - - '>='
97
89
  - !ruby/object:Gem::Version
98
90
  version: '0'
99
91
  requirements: []
100
92
  rubyforge_project:
101
- rubygems_version: 1.8.25
93
+ rubygems_version: 2.0.3
102
94
  signing_key:
103
- specification_version: 3
95
+ specification_version: 4
104
96
  summary: Uy::Rut is a class that allows to validate RUT numbers or generate fake ones
105
97
  for testing purposes
106
98
  test_files:
107
99
  - spec/rut_spec.rb
108
- has_rdoc: