br_documents 0.0.3 → 0.0.4
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/README.md +4 -2
- data/lib/br_documents/cnpj_cpf/cnpj.rb +4 -0
- data/lib/br_documents/cnpj_cpf/cpf.rb +4 -0
- data/lib/br_documents/version.rb +1 -1
- data/spec/cnpj_cpf/cnpj_spec.rb +7 -0
- data/spec/cnpj_cpf/cpf_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1965ccaaf6c4d64308cc6cc533e0d074edfb6566
|
4
|
+
data.tar.gz: ade8e62331140d9103b4b4763c38fa4d428e2e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab6b906a9bf27ad17dd224c0c257017d4bb3f8196433db00d0e83666041443e89dfe24f156c664d1d5d217e9f8f103d02f2b9243ca4cfb9984a450e037a8ed0
|
7
|
+
data.tar.gz: 71ad23081b998135bc6d764b77f73022fc7f038fcd89ceb289852e4dd0ba4df787979d5f75376c4e776dce51467c797c4f161d37673f65ae0e21617eb2a8eef4
|
data/README.md
CHANGED
@@ -118,14 +118,16 @@ pj.valid? # => false
|
|
118
118
|
#### CNPJ
|
119
119
|
|
120
120
|
```ruby
|
121
|
-
cnpj = BrDocuments::CnpjCpf::Cnpj.new("
|
121
|
+
cnpj = BrDocuments::CnpjCpf::Cnpj.new("04001155000101")
|
122
|
+
cnpj.formatted # => "04.001.155/0001-01"
|
122
123
|
cnpj.valid? # => true
|
123
124
|
```
|
124
125
|
|
125
126
|
#### CPF
|
126
127
|
|
127
128
|
```ruby
|
128
|
-
cpf = BrDocuments::CnpjCpf::Cpf.new("
|
129
|
+
cpf = BrDocuments::CnpjCpf::Cpf.new("11144477735")
|
130
|
+
cpf.formatted # => "111.444.777-35"
|
129
131
|
cpf.valid? # => true
|
130
132
|
```
|
131
133
|
|
data/lib/br_documents/version.rb
CHANGED
data/spec/cnpj_cpf/cnpj_spec.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe BrDocuments::CnpjCpf::Cnpj do
|
4
|
+
describe "#formatted" do
|
5
|
+
it "returns a formatted number" do
|
6
|
+
cnpj = BrDocuments::CnpjCpf::Cnpj.new("04001155000101")
|
7
|
+
expect(cnpj.formatted).to eq "04.001.155/0001-01"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
4
11
|
it "is invalid with malformed number" do
|
5
12
|
["242.2818/50001-54", "35.611.011/000192"].each do |number|
|
6
13
|
cnpj = BrDocuments::CnpjCpf::Cnpj.new(number)
|
data/spec/cnpj_cpf/cpf_spec.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe BrDocuments::CnpjCpf::Cpf do
|
4
|
+
describe "#formatted" do
|
5
|
+
it "returns a formatted number" do
|
6
|
+
cpf = BrDocuments::CnpjCpf::Cpf.new("11144477735")
|
7
|
+
expect(cpf.formatted).to eq "111.444.777-35"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
4
11
|
it "is invalid with malformed number" do
|
5
12
|
["111.126.491.07", "482.261.15-663", "111444.777-35"].each do |number|
|
6
13
|
cpf = BrDocuments::CnpjCpf::Cpf.new(number)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
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-04-
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|