br_documents 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f64e2139b8c0f45f67ba0d9a3faaa849cf234f2d
4
- data.tar.gz: a334fc18af1193c28d8faff57cc2f75c0e26c5f2
3
+ metadata.gz: 8a1d30ad368278bb84c8e042fdf444957d9446f9
4
+ data.tar.gz: 354f2944e1f35a1457a14cf03d61463d1f091c9b
5
5
  SHA512:
6
- metadata.gz: 6b7e01d7e6ac58d51dde5d7ad3a117bff65e6b2957b58c96af99b61c0c298076243681a7f9ae044ec46803830c9ef41b8c94fce81f1653265752f0a99156fc5c
7
- data.tar.gz: 74e23ac1af71312b733e33b9793072a0c98f3b9af1e5b86e1740bcd152ef55512662ca6c75aa847d05290a16f0f2d5f332dd7cd724ec108f07bab6de345a9505
6
+ metadata.gz: f78bbcdb13703e2737aeee5a026c0bdc5ea5e3325fd23e3924b1e0f504276611bf307eb039daf066c9e19e20ea5b6df8bab97a9f8a16455b33685a8b46787a0d
7
+ data.tar.gz: 74b59bab7e885a5f7a8d8c6bd137867bcd617d7a2f184aa0822984626ffc48b541a654c1b809c364b98ba8e005148fccc40ddf36f0a0096566fbbfacbc1aacb4
@@ -31,9 +31,7 @@ class IeValidator < ActiveModel::EachValidator
31
31
 
32
32
  def ie_valid?(record, attribute, value)
33
33
  begin
34
- if (not number_valid?(record, value)) && (not exempted?(value))
35
- record.errors.add(attribute, :invalid)
36
- end
34
+ record.errors.add(attribute, :invalid) unless number_valid?(record, value)
37
35
  rescue ArgumentError => ex
38
36
  record.errors.add(attribute, ex.message)
39
37
  end
@@ -46,10 +44,6 @@ class IeValidator < ActiveModel::EachValidator
46
44
  ie_number.valid?
47
45
  end
48
46
 
49
- def exempted?(value)
50
- "isento".casecmp(value) == 0
51
- end
52
-
53
47
  def read_uf(record)
54
48
  attribute = record
55
49
  options[:uf].split("#").each do | field |
@@ -1,3 +1,3 @@
1
1
  module BrDocuments
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -22,14 +22,6 @@ describe IeValidator do
22
22
  end
23
23
  end
24
24
 
25
- context "when IE is 'ISENTO'" do
26
- before { subject.validate_each(record, "ie", "ISENTO") }
27
-
28
- it "doesn't add errors in model" do
29
- expect(record.errors.messages).to be_empty
30
- end
31
- end
32
-
33
25
  context "when IE is blank" do
34
26
  before { subject.validate_each(record, "ie", "") }
35
27
 
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.13
4
+ version: 0.0.14
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: 2017-03-15 00:00:00.000000000 Z
11
+ date: 2017-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  requirements: []
237
237
  rubyforge_project:
238
- rubygems_version: 2.4.8
238
+ rubygems_version: 2.6.8
239
239
  signing_key:
240
240
  specification_version: 4
241
241
  summary: Validates brazilian documents like CPF, CNPJ and IE. It can be used with