validates_cnpj 3.0.0 → 3.2.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +27 -6
- data/.ruby-version +1 -1
- data/.travis.yml +37 -10
- data/README.md +2 -1
- data/Rakefile +3 -0
- data/gemfiles/Gemfile.rails5 +1 -1
- data/gemfiles/Gemfile.rails6 +5 -0
- data/lib/validates_cnpj/cnpj.rb +8 -8
- data/lib/validates_cnpj/cnpj_validator.rb +13 -2
- data/lib/validates_cnpj/require_a_valid_cnpj_matcher.rb +1 -1
- data/lib/validates_cnpj/version.rb +1 -1
- data/spec/cnpj_validator_spec.rb +40 -5
- data/spec/fake_app/masked_company.rb +17 -0
- data/spec/spec_helper.rb +1 -10
- data/spec/validates_cnpj/cnpj_spec.rb +40 -0
- data/validates_cnpj.gemspec +3 -3
- metadata +20 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76d72b266a42dbde1f4a3bd6b0d4822450b29e617049699a8c9c7ec13248ce79
|
|
4
|
+
data.tar.gz: 21b2439edb281c481c1a3199ecbc992db3452bbdf775101010c29d9ed06d5f61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5182b579f3926d2e29fb0a7e58c1894b2b6455e3a8e09fe6698ff307f56e7fd4680cb0a054513754b02ac810934a23e598b6ba72b439234ee7f015756e6897a9
|
|
7
|
+
data.tar.gz: c2621693f873408f0864f59f69d6d2df85f7ec72a18ca3129776cb00f2a9353c0f8b1b041ebc1c9a78d5e3c1b92cc27fac7427512eb14d0fdd393a9d313ee9e1
|
data/.rubocop.yml
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rake
|
|
3
|
+
- rubocop-rspec
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
AllCops:
|
|
6
|
+
NewCops: enable
|
|
7
|
+
TargetRubyVersion: 2.2
|
|
8
|
+
|
|
9
|
+
Gemspec/DevelopmentDependencies:
|
|
10
|
+
Enabled: false
|
|
11
|
+
|
|
12
|
+
Layout/LineLength:
|
|
13
|
+
Max: 150
|
|
14
|
+
|
|
15
|
+
Metrics/AbcSize:
|
|
4
16
|
Enabled: false
|
|
5
17
|
|
|
6
18
|
Metrics/BlockLength:
|
|
7
19
|
Enabled: false
|
|
8
20
|
|
|
9
|
-
Metrics/
|
|
10
|
-
|
|
21
|
+
Metrics/CyclomaticComplexity:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Metrics/MethodLength:
|
|
25
|
+
Max: 25
|
|
26
|
+
|
|
27
|
+
Metrics/PerceivedComplexity:
|
|
28
|
+
Enabled: false
|
|
11
29
|
|
|
12
30
|
RSpec/DescribedClass:
|
|
13
|
-
|
|
31
|
+
Enabled: false
|
|
14
32
|
|
|
15
33
|
Style/Documentation:
|
|
16
|
-
Enabled: false
|
|
34
|
+
Enabled: false
|
|
35
|
+
|
|
36
|
+
Style/RedundantConstantBase:
|
|
37
|
+
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.5
|
data/.travis.yml
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
gemfile:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
matrix:
|
|
2
|
+
include:
|
|
3
|
+
- rvm: 2.2
|
|
4
|
+
gemfile: gemfiles/Gemfile.rails4
|
|
5
|
+
- rvm: 2.2
|
|
6
|
+
gemfile: gemfiles/Gemfile.rails5
|
|
7
|
+
- rvm: 2.3
|
|
8
|
+
gemfile: gemfiles/Gemfile.rails4
|
|
9
|
+
- rvm: 2.3
|
|
10
|
+
gemfile: gemfiles/Gemfile.rails5
|
|
11
|
+
- rvm: 2.4
|
|
12
|
+
gemfile: gemfiles/Gemfile.rails4
|
|
13
|
+
- rvm: 2.4
|
|
14
|
+
gemfile: gemfiles/Gemfile.rails5
|
|
15
|
+
- rvm: 2.5
|
|
16
|
+
gemfile: gemfiles/Gemfile.rails4
|
|
17
|
+
- rvm: 2.5
|
|
18
|
+
gemfile: gemfiles/Gemfile.rails5
|
|
19
|
+
- rvm: 2.5
|
|
20
|
+
gemfile: gemfiles/Gemfile.rails6
|
|
21
|
+
- rvm: 2.6
|
|
22
|
+
gemfile: gemfiles/Gemfile.rails4
|
|
23
|
+
- rvm: 2.6
|
|
24
|
+
gemfile: gemfiles/Gemfile.rails5
|
|
25
|
+
- rvm: 2.6
|
|
26
|
+
gemfile: gemfiles/Gemfile.rails6
|
|
27
|
+
- rvm: 2.7
|
|
28
|
+
gemfile: gemfiles/Gemfile.rails4
|
|
29
|
+
- rvm: 2.7
|
|
30
|
+
gemfile: gemfiles/Gemfile.rails5
|
|
31
|
+
- rvm: 2.7
|
|
32
|
+
gemfile: gemfiles/Gemfile.rails6
|
|
33
|
+
- rvm: 3.0
|
|
34
|
+
gemfile: gemfiles/Gemfile.rails4
|
|
35
|
+
- rvm: 3.0
|
|
36
|
+
gemfile: gemfiles/Gemfile.rails6
|
|
37
|
+
script: rake complete
|
data/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/validates_cnpj) [](http://travis-ci.org/plribeiro3000/validates_cnpj) [](https://coveralls.io/r/plribeiro3000/validates_cnpj) [](https://codeclimate.com/github/plribeiro3000/validates_cnpj)
|
|
4
4
|
|
|
5
|
-
Validates cnpj and test it in a simple way
|
|
5
|
+
Validates cnpj and test it in a simple way.
|
|
6
|
+
Supports ruby 2.2+ and rails 3+.
|
|
6
7
|
|
|
7
8
|
## Installation
|
|
8
9
|
|
data/Rakefile
CHANGED
data/gemfiles/Gemfile.rails5
CHANGED
data/lib/validates_cnpj/cnpj.rb
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
module ValidatesCnpj
|
|
4
4
|
class Cnpj
|
|
5
5
|
def initialize(number)
|
|
6
|
-
number =~ %r{^(\d{2}
|
|
6
|
+
number.to_s.upcase =~ %r{^([A-Z\d]{2}\.?[A-Z\d]{3}\.?[A-Z\d]{3}/?[A-Z\d]{4})-?(\d{2})$}
|
|
7
7
|
@number = number
|
|
8
8
|
@pure_number = Regexp.last_match(1)
|
|
9
9
|
@result = Regexp.last_match(2)
|
|
10
|
-
@cleaned_number = @pure_number.nil? ? nil : @number.gsub(%r{[
|
|
10
|
+
@cleaned_number = @pure_number.nil? ? nil : @number.to_s.upcase.gsub(%r{[./-]}, '')
|
|
11
11
|
format_number! if @pure_number
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,15 +15,15 @@ module ValidatesCnpj
|
|
|
15
15
|
return true if @number.blank?
|
|
16
16
|
return false unless @pure_number
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
valid_cnpj?
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
attr_reader :number
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
|
-
def
|
|
26
|
-
return false if (@cleaned_number.length != 14) || (@cleaned_number.
|
|
25
|
+
def valid_cnpj?
|
|
26
|
+
return false if (@cleaned_number.length != 14) || (@cleaned_number[0, 12].chars.uniq.length == 1)
|
|
27
27
|
|
|
28
28
|
@result == first_digit_verifier + second_digit_verifier
|
|
29
29
|
end
|
|
@@ -40,8 +40,8 @@ module ValidatesCnpj
|
|
|
40
40
|
|
|
41
41
|
def multiply_and_sum(array, number)
|
|
42
42
|
multiplied = []
|
|
43
|
-
number.scan(
|
|
44
|
-
multiplied.inject { |
|
|
43
|
+
number.scan(/[A-Z\d]/).each_with_index { |character, index| multiplied[index] = (character.ord - 48) * array[index] }
|
|
44
|
+
multiplied.inject { |sum, element| sum + element }
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def digit_verifier(rest)
|
|
@@ -49,7 +49,7 @@ module ValidatesCnpj
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def format_number!
|
|
52
|
-
@cleaned_number =~ /(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/
|
|
52
|
+
@cleaned_number =~ /([A-Z\d]{2})([A-Z\d]{3})([A-Z\d]{3})([A-Z\d]{4})(\d{2})/
|
|
53
53
|
|
|
54
54
|
match1 = Regexp.last_match(1)
|
|
55
55
|
match2 = Regexp.last_match(2)
|
|
@@ -5,9 +5,20 @@ class CnpjValidator < ActiveModel::EachValidator
|
|
|
5
5
|
cnpj = ValidatesCnpj::Cnpj.new(value)
|
|
6
6
|
|
|
7
7
|
if cnpj.valid?
|
|
8
|
-
|
|
8
|
+
if options[:mask]
|
|
9
|
+
record.send("#{attribute}=", cnpj.number)
|
|
10
|
+
elsif value.is_a?(String) && value != value.upcase
|
|
11
|
+
record.send("#{attribute}=", value.upcase)
|
|
12
|
+
end
|
|
9
13
|
else
|
|
10
|
-
|
|
14
|
+
ruby_prior_version_three =
|
|
15
|
+
Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
|
|
16
|
+
|
|
17
|
+
if ruby_prior_version_three
|
|
18
|
+
record.errors.add(attribute, :invalid, options)
|
|
19
|
+
else
|
|
20
|
+
record.errors.add(attribute, :invalid, **options)
|
|
21
|
+
end
|
|
11
22
|
end
|
|
12
23
|
end
|
|
13
24
|
end
|
|
@@ -17,7 +17,7 @@ module Shoulda
|
|
|
17
17
|
|
|
18
18
|
def matches?(subject)
|
|
19
19
|
@subject = subject
|
|
20
|
-
disallows_value_of('123456') && allows_value_of('51.114.450/0001-46')
|
|
20
|
+
disallows_value_of('123456') && allows_value_of('51.114.450/0001-46') && allows_value_of('AB.12C.D34/EFGH-83')
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
data/spec/cnpj_validator_spec.rb
CHANGED
|
@@ -8,12 +8,12 @@ describe CnpjValidator do
|
|
|
8
8
|
context 'when cnpj is invalid' do
|
|
9
9
|
before do
|
|
10
10
|
company.cnpj = 12_345
|
|
11
|
-
allow(I18n).to receive(:t).with(:
|
|
12
|
-
default: :
|
|
11
|
+
allow(I18n).to receive(:t).with(:'activerecord.errors.models.company.attributes.cnpj.invalid',
|
|
12
|
+
default: :'activerecord.errors.messages.invalid').and_return('is invalid')
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it 'sets object as invalid' do
|
|
16
|
-
expect(company.valid?).to
|
|
16
|
+
expect(company.valid?).to be(false)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it 'sets an error on attribute' do
|
|
@@ -28,7 +28,7 @@ describe CnpjValidator do
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
it 'sets object as valid' do
|
|
31
|
-
expect(company.valid?).to
|
|
31
|
+
expect(company.valid?).to be(true)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it 'does not set an error on attribute' do
|
|
@@ -37,7 +37,42 @@ describe CnpjValidator do
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
context 'when cnpj has lowercase letters' do
|
|
41
|
+
before do
|
|
42
|
+
company.cnpj = 'ab12cd34efgh83'
|
|
43
|
+
company.valid?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'upcases the value' do
|
|
47
|
+
expect(company.cnpj).to eq('AB12CD34EFGH83')
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context 'when cnpj is numeric' do
|
|
52
|
+
before do
|
|
53
|
+
company.cnpj = '37525685000108'
|
|
54
|
+
company.valid?
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'keeps the value as it was' do
|
|
58
|
+
expect(company.cnpj).to eq('37525685000108')
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
context 'with the mask option' do
|
|
63
|
+
let(:company) { MaskedCompany.new }
|
|
64
|
+
|
|
65
|
+
before do
|
|
66
|
+
company.cnpj = 'ab12cd34efgh83'
|
|
67
|
+
company.valid?
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'upcases and masks the value' do
|
|
71
|
+
expect(company.cnpj).to eq('AB.12C.D34/EFGH-83')
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
40
75
|
it 'accepts a nil value' do
|
|
41
|
-
expect(company.valid?).to
|
|
76
|
+
expect(company.valid?).to be(true)
|
|
42
77
|
end
|
|
43
78
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class MaskedCompany
|
|
4
|
+
include ActiveModel::Validations
|
|
5
|
+
include ActiveModel::Conversion
|
|
6
|
+
extend ActiveModel::Naming
|
|
7
|
+
|
|
8
|
+
attr_accessor :cnpj, :name
|
|
9
|
+
|
|
10
|
+
validates :cnpj, cnpj: { mask: true }
|
|
11
|
+
|
|
12
|
+
def initialize(attributes = {})
|
|
13
|
+
attributes.each do |key, value|
|
|
14
|
+
instance_variable_set("@#{key}", value)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -3,18 +3,8 @@
|
|
|
3
3
|
require 'rspec'
|
|
4
4
|
require 'active_model'
|
|
5
5
|
require 'coveralls'
|
|
6
|
-
require 'jazz_fingers'
|
|
7
6
|
require 'shoulda-matchers'
|
|
8
7
|
|
|
9
|
-
JazzFingers.configure do |config|
|
|
10
|
-
config.colored_prompt = false
|
|
11
|
-
config.awesome_print = false
|
|
12
|
-
config.coolline = false
|
|
13
|
-
config.application_name = ValidatesCnpj
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
require 'jazz_fingers/setup'
|
|
17
|
-
|
|
18
8
|
RSpec.configure do |config|
|
|
19
9
|
config.include Shoulda::Matchers::ActiveModel
|
|
20
10
|
end
|
|
@@ -23,3 +13,4 @@ Coveralls.wear!
|
|
|
23
13
|
|
|
24
14
|
require File.expand_path('lib/validates_cnpj')
|
|
25
15
|
require File.expand_path('spec/fake_app/company')
|
|
16
|
+
require File.expand_path('spec/fake_app/masked_company')
|
|
@@ -47,6 +47,26 @@ describe ValidatesCnpj::Cnpj do
|
|
|
47
47
|
it '6910360400016000 as number' do
|
|
48
48
|
expect(ValidatesCnpj::Cnpj.new('6910360400016000')).not_to be_valid
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
it 'AB12CD34EFGH84 as number' do
|
|
52
|
+
expect(ValidatesCnpj::Cnpj.new('AB12CD34EFGH84')).not_to be_valid
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'AB.12C.D34/EFGH-84 as number' do
|
|
56
|
+
expect(ValidatesCnpj::Cnpj.new('AB.12C.D34/EFGH-84')).not_to be_valid
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'AAAAAAAAAAAA00 as number' do
|
|
60
|
+
expect(ValidatesCnpj::Cnpj.new('AAAAAAAAAAAA00')).not_to be_valid
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'AB12CD34EFGH8 as number' do
|
|
64
|
+
expect(ValidatesCnpj::Cnpj.new('AB12CD34EFGH8')).not_to be_valid
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'AB12CD34EFGHAB as number' do
|
|
68
|
+
expect(ValidatesCnpj::Cnpj.new('AB12CD34EFGHAB')).not_to be_valid
|
|
69
|
+
end
|
|
50
70
|
end
|
|
51
71
|
|
|
52
72
|
context 'with valid option' do
|
|
@@ -77,12 +97,32 @@ describe ValidatesCnpj::Cnpj do
|
|
|
77
97
|
it '00.000.000/1447-89 as number' do
|
|
78
98
|
expect(ValidatesCnpj::Cnpj.new('00.000.000/1447-89')).to be_valid
|
|
79
99
|
end
|
|
100
|
+
|
|
101
|
+
it 'AB12CD34EFGH83 as number' do
|
|
102
|
+
expect(ValidatesCnpj::Cnpj.new('AB12CD34EFGH83')).to be_valid
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it 'AB.12C.D34/EFGH-83 as number' do
|
|
106
|
+
expect(ValidatesCnpj::Cnpj.new('AB.12C.D34/EFGH-83')).to be_valid
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it 'ab12cd34efgh83 as number' do
|
|
110
|
+
expect(ValidatesCnpj::Cnpj.new('ab12cd34efgh83')).to be_valid
|
|
111
|
+
end
|
|
80
112
|
end
|
|
81
113
|
|
|
82
114
|
context 'with a valid value' do
|
|
83
115
|
it 'returns it formatted' do
|
|
84
116
|
expect(ValidatesCnpj::Cnpj.new('69103604000160').number).to eq('69.103.604/0001-60')
|
|
85
117
|
end
|
|
118
|
+
|
|
119
|
+
it 'returns an alphanumeric number formatted' do
|
|
120
|
+
expect(ValidatesCnpj::Cnpj.new('AB12CD34EFGH83').number).to eq('AB.12C.D34/EFGH-83')
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it 'returns a lowercase alphanumeric number formatted and upcased' do
|
|
124
|
+
expect(ValidatesCnpj::Cnpj.new('ab12cd34efgh83').number).to eq('AB.12C.D34/EFGH-83')
|
|
125
|
+
end
|
|
86
126
|
end
|
|
87
127
|
|
|
88
128
|
context 'with an invalid value' do
|
data/validates_cnpj.gemspec
CHANGED
|
@@ -10,7 +10,6 @@ Gem::Specification.new do |gem|
|
|
|
10
10
|
gem.summary = 'Validates CNPJ and test it with matchers in a simple way.'
|
|
11
11
|
|
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
|
13
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
14
13
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
15
14
|
gem.require_paths = %w[lib]
|
|
16
15
|
|
|
@@ -19,12 +18,13 @@ Gem::Specification.new do |gem|
|
|
|
19
18
|
gem.license = 'MIT'
|
|
20
19
|
|
|
21
20
|
gem.add_development_dependency 'coveralls'
|
|
22
|
-
gem.add_development_dependency 'jazz_fingers', '< 5.0.0'
|
|
23
21
|
gem.add_development_dependency 'rake'
|
|
24
22
|
gem.add_development_dependency 'rspec'
|
|
25
23
|
gem.add_development_dependency 'rubocop'
|
|
24
|
+
gem.add_development_dependency 'rubocop-rake'
|
|
26
25
|
gem.add_development_dependency 'rubocop-rspec'
|
|
27
26
|
gem.add_development_dependency 'shoulda-matchers'
|
|
28
27
|
|
|
29
|
-
gem.
|
|
28
|
+
gem.add_dependency 'activemodel'
|
|
29
|
+
gem.metadata['rubygems_mfa_required'] = 'true'
|
|
30
30
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: validates_cnpj
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paulo Henrique Lopes Ribeiro
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: coveralls
|
|
@@ -25,21 +24,21 @@ dependencies:
|
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: rake
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - "
|
|
30
|
+
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
32
|
+
version: '0'
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- - "
|
|
37
|
+
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
39
|
+
version: '0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
41
|
+
name: rspec
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
44
|
- - ">="
|
|
@@ -53,7 +52,7 @@ dependencies:
|
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
53
|
version: '0'
|
|
55
54
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
55
|
+
name: rubocop
|
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
|
58
57
|
requirements:
|
|
59
58
|
- - ">="
|
|
@@ -67,7 +66,7 @@ dependencies:
|
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
67
|
version: '0'
|
|
69
68
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rubocop
|
|
69
|
+
name: rubocop-rake
|
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
|
72
71
|
requirements:
|
|
73
72
|
- - ">="
|
|
@@ -112,23 +111,16 @@ dependencies:
|
|
|
112
111
|
name: activemodel
|
|
113
112
|
requirement: !ruby/object:Gem::Requirement
|
|
114
113
|
requirements:
|
|
115
|
-
- - "
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '4.0'
|
|
118
|
-
- - "<"
|
|
114
|
+
- - ">="
|
|
119
115
|
- !ruby/object:Gem::Version
|
|
120
|
-
version: '
|
|
116
|
+
version: '0'
|
|
121
117
|
type: :runtime
|
|
122
118
|
prerelease: false
|
|
123
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
124
120
|
requirements:
|
|
125
|
-
- - "
|
|
126
|
-
- !ruby/object:Gem::Version
|
|
127
|
-
version: '4.0'
|
|
128
|
-
- - "<"
|
|
121
|
+
- - ">="
|
|
129
122
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: '
|
|
131
|
-
description:
|
|
123
|
+
version: '0'
|
|
132
124
|
email: plribeiro3000@gmail.com
|
|
133
125
|
executables: []
|
|
134
126
|
extensions: []
|
|
@@ -146,6 +138,7 @@ files:
|
|
|
146
138
|
- Rakefile
|
|
147
139
|
- gemfiles/Gemfile.rails4
|
|
148
140
|
- gemfiles/Gemfile.rails5
|
|
141
|
+
- gemfiles/Gemfile.rails6
|
|
149
142
|
- lib/validates_cnpj.rb
|
|
150
143
|
- lib/validates_cnpj/cnpj.rb
|
|
151
144
|
- lib/validates_cnpj/cnpj_validator.rb
|
|
@@ -153,15 +146,15 @@ files:
|
|
|
153
146
|
- lib/validates_cnpj/version.rb
|
|
154
147
|
- spec/cnpj_validator_spec.rb
|
|
155
148
|
- spec/fake_app/company.rb
|
|
149
|
+
- spec/fake_app/masked_company.rb
|
|
156
150
|
- spec/shoulda/matchers/active_model/require_a_valid_cnpj_matcher_spec.rb
|
|
157
151
|
- spec/spec_helper.rb
|
|
158
152
|
- spec/validates_cnpj/cnpj_spec.rb
|
|
159
153
|
- validates_cnpj.gemspec
|
|
160
|
-
homepage:
|
|
161
154
|
licenses:
|
|
162
155
|
- MIT
|
|
163
|
-
metadata:
|
|
164
|
-
|
|
156
|
+
metadata:
|
|
157
|
+
rubygems_mfa_required: 'true'
|
|
165
158
|
rdoc_options: []
|
|
166
159
|
require_paths:
|
|
167
160
|
- lib
|
|
@@ -176,13 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
176
169
|
- !ruby/object:Gem::Version
|
|
177
170
|
version: '0'
|
|
178
171
|
requirements: []
|
|
179
|
-
rubygems_version:
|
|
180
|
-
signing_key:
|
|
172
|
+
rubygems_version: 4.0.10
|
|
181
173
|
specification_version: 4
|
|
182
174
|
summary: Validates CNPJ and test it with matchers in a simple way.
|
|
183
|
-
test_files:
|
|
184
|
-
- spec/cnpj_validator_spec.rb
|
|
185
|
-
- spec/fake_app/company.rb
|
|
186
|
-
- spec/shoulda/matchers/active_model/require_a_valid_cnpj_matcher_spec.rb
|
|
187
|
-
- spec/spec_helper.rb
|
|
188
|
-
- spec/validates_cnpj/cnpj_spec.rb
|
|
175
|
+
test_files: []
|