Sha256: 1d785c8815c06a35d7a2316c4682430fd8db9c8904e444d1954bc110ddc8e18b
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
= ValidatesCNPJ {<img src="https://secure.travis-ci.org/plribeiro3000/validates_cnpj.png" />}[http://travis-ci.org/plribeiro3000/validates_cnpj] Rails gem to validate CNPJ. Don't forget to check {ValidatesCpf}[https://github.com/plribeiro3000/validates_cpf] and {ValidatesTelephone}[https://github.com/plribeiro3000/validates_telephone]. == Install gem install validates_cnpj == Usage Lets say you have a model with "cnpj" string column that you want to be a valid CNPJ. Just add this to your model: class User < ActiveRecord::Base validates :cnpj, :cnpj => true end == Test This gem has matchers for shoulda-matchers and remarkable. If you are using shoulda-matchers, add this line to your spec_helper.rb : require "validates_cnpj/shoulda-matchers/validate_as_cnpj_matcher" If you are using remarkable, add this line to your spec_helper.rb : require "validates_cnpj/remarkable/validate_as_cnpj_matcher" === How? You should use validates_as_cnpj(:attribute) just like any other shoulda matcher. == Goal This project is based on brcpfcnpj gem and his intention it to mantain a cleaner code to validate CNPJ and easy matchers to test it.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_cnpj-0.1.1 | README.rdoc |