br_documents 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/br_documents.gemspec +7 -6
- data/lib/br_documents/version.rb +1 -1
- data/spec/cnpj_validator_spec.rb +3 -3
- data/spec/cpf_validator_spec.rb +3 -3
- data/spec/ie_validator_spec.rb +6 -6
- metadata +45 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ffff484199e61ad79fdeb11dfa7eb9f86d86c42
|
4
|
+
data.tar.gz: 907b887cbd299af65c0d851693df4ed7e3f8f527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: defb84a18fe3411533175bb3628aa7fad302199bde866c47eec1f73b61779458de67a120dbacfd4ece76dfc1364f02ddcedc5f351216d4c27b2c86094b5247f8
|
7
|
+
data.tar.gz: 9c22b1fff6078bd221be1e1110cc791d434e58106313b3c65241e76ef12a6a74be48bfb91e07fb5e5424c81eb4bc696d9b0c3d697f62cf8ed5907a503257ba13
|
data/br_documents.gemspec
CHANGED
@@ -18,11 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.
|
23
|
-
spec.add_development_dependency "rspec", "~> 2.14.1"
|
24
|
-
spec.add_development_dependency "codeclimate-test-reporter"
|
21
|
+
spec.add_dependency "activemodel", ">= 4.0.0"
|
22
|
+
spec.add_dependency "i18n", ">= 0.6.5"
|
25
23
|
|
26
|
-
spec.
|
27
|
-
spec.
|
24
|
+
spec.add_development_dependency "bundler", ">= 1.3"
|
25
|
+
spec.add_development_dependency "rake", ">= 10.1.0"
|
26
|
+
spec.add_development_dependency "rspec", ">= 3.0.0"
|
27
|
+
spec.add_development_dependency "codeclimate-test-reporter"
|
28
|
+
spec.add_development_dependency "simplecov", ">= 0.9.0"
|
28
29
|
end
|
data/lib/br_documents/version.rb
CHANGED
data/spec/cnpj_validator_spec.rb
CHANGED
@@ -4,9 +4,9 @@ describe CnpjValidator do
|
|
4
4
|
before(:each) do
|
5
5
|
@validator = CnpjValidator.new(attributes: "cnpj")
|
6
6
|
@mock = double("model")
|
7
|
-
@mock.
|
8
|
-
@mock.errors.
|
9
|
-
@mock.errors.
|
7
|
+
allow(@mock).to receive(:errors).and_return([])
|
8
|
+
allow(@mock.errors).to receive(:messages).and_return({})
|
9
|
+
allow(@mock.errors).to receive(:add) do | attribute, error |
|
10
10
|
@mock.errors.messages[attribute] = [error]
|
11
11
|
end
|
12
12
|
end
|
data/spec/cpf_validator_spec.rb
CHANGED
@@ -4,9 +4,9 @@ describe CpfValidator do
|
|
4
4
|
before(:each) do
|
5
5
|
@validator = CpfValidator.new(attributes: "cpf")
|
6
6
|
@mock = double("model")
|
7
|
-
@mock.
|
8
|
-
@mock.errors.
|
9
|
-
@mock.errors.
|
7
|
+
allow(@mock).to receive(:errors).and_return([])
|
8
|
+
allow(@mock.errors).to receive(:messages).and_return({})
|
9
|
+
allow(@mock.errors).to receive(:add) do | attribute, error |
|
10
10
|
@mock.errors.messages[attribute] = [error]
|
11
11
|
end
|
12
12
|
end
|
data/spec/ie_validator_spec.rb
CHANGED
@@ -4,10 +4,10 @@ describe IeValidator do
|
|
4
4
|
before(:each) do
|
5
5
|
@validator = IeValidator.new(attributes: "ie", uf: "uf")
|
6
6
|
@mock = double("model")
|
7
|
-
@mock.
|
8
|
-
@mock.
|
9
|
-
@mock.errors.
|
10
|
-
@mock.errors.
|
7
|
+
allow(@mock).to receive(:uf) {"SC"}
|
8
|
+
allow(@mock).to receive(:errors).and_return([])
|
9
|
+
allow(@mock.errors).to receive(:messages).and_return({})
|
10
|
+
allow(@mock.errors).to receive(:add) do | attribute, error |
|
11
11
|
@mock.errors.messages[attribute] = [error]
|
12
12
|
end
|
13
13
|
end
|
@@ -44,7 +44,7 @@ describe IeValidator do
|
|
44
44
|
|
45
45
|
context "when UF is invalid" do
|
46
46
|
it "adds error in model" do
|
47
|
-
@mock.
|
47
|
+
allow(@mock).to receive(:uf){""}
|
48
48
|
subject.validate_each(@mock, "ie", "253667852")
|
49
49
|
expect(@mock.errors.messages["ie"]).to eql [t("validator.ie.uf.invalid")]
|
50
50
|
end
|
@@ -52,7 +52,7 @@ describe IeValidator do
|
|
52
52
|
|
53
53
|
context "when it can't find attribute uf in model" do
|
54
54
|
it "adds error in model" do
|
55
|
-
@mock.
|
55
|
+
allow(@mock).to receive(:uf).and_raise(NoMethodError)
|
56
56
|
subject.validate_each(@mock, "ie", "253667852")
|
57
57
|
expect(@mock.errors.messages[:base]).to eql [
|
58
58
|
t("validator.ie.uf.no_present", uf: "uf")
|
metadata
CHANGED
@@ -1,57 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: br_documents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ASSEINFO - Sistemas de Informação
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activemodel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: i18n
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.6.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.5
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
|
-
- -
|
45
|
+
- - '>='
|
18
46
|
- !ruby/object:Gem::Version
|
19
47
|
version: '1.3'
|
20
48
|
type: :development
|
21
49
|
prerelease: false
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
23
51
|
requirements:
|
24
|
-
- -
|
52
|
+
- - '>='
|
25
53
|
- !ruby/object:Gem::Version
|
26
54
|
version: '1.3'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rake
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
|
-
- -
|
59
|
+
- - '>='
|
32
60
|
- !ruby/object:Gem::Version
|
33
61
|
version: 10.1.0
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
|
-
- -
|
66
|
+
- - '>='
|
39
67
|
- !ruby/object:Gem::Version
|
40
68
|
version: 10.1.0
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: rspec
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
|
-
- -
|
73
|
+
- - '>='
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
75
|
+
version: 3.0.0
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
|
-
- -
|
80
|
+
- - '>='
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
82
|
+
version: 3.0.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: codeclimate-test-reporter
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,33 +95,19 @@ dependencies:
|
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 4.0.0
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ~>
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 4.0.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: i18n
|
98
|
+
name: simplecov
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - '>='
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
90
|
-
type: :
|
103
|
+
version: 0.9.0
|
104
|
+
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
110
|
+
version: 0.9.0
|
97
111
|
description: Validates brazilian documents like CPF, CNPJ and IE.
|
98
112
|
email:
|
99
113
|
- asseinfo@asseinfo.com.br
|
@@ -247,3 +261,4 @@ test_files:
|
|
247
261
|
- spec/ie_validator_spec.rb
|
248
262
|
- spec/spec_helper.rb
|
249
263
|
- spec/support/utilities.rb
|
264
|
+
has_rdoc:
|