br_documents 0.0.13 → 0.0.14
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/lib/br_documents/ie_validator.rb +1 -7
- data/lib/br_documents/version.rb +1 -1
- data/spec/ie_validator_spec.rb +0 -8
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8a1d30ad368278bb84c8e042fdf444957d9446f9
         | 
| 4 | 
            +
              data.tar.gz: 354f2944e1f35a1457a14cf03d61463d1f091c9b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 | 
            -
                   | 
| 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 |
         | 
    
        data/lib/br_documents/version.rb
    CHANGED
    
    
    
        data/spec/ie_validator_spec.rb
    CHANGED
    
    | @@ -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. | 
| 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- | 
| 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. | 
| 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
         |