Sha256: 802b24ba3f68600563acc98673ba750b214b8e760056f6f25858a36fa7f26efc
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 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 == 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 Only Rspec supported at the moment. The gem already have macros for shoulda-macros 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. == Special Thanks This project is based on brcpfcnpj gem and his intention it to mantain a cleaner code to validate CNPJ and easy macros to test it.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_cnpj-0.1.0 | README.rdoc |
validates_cnpj-0.0.1 | README.rdoc |