Sha256: f4bef034fe6b956a952eccda2f1197a1f456c99cf6141632a9a93d6ae2214f56

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

= ValidatesCPF

Rails gem to validate CPF

== Install

gem install validates_cpf

== Usage

Lets say you have a model with "cpf" string column that you want to be a valid CPF. Just add this to your model:

class User < ActiveRecord::Base
    validates :cpf, :cpf => 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_cpf/shoulda-matchers/validate_as_cpf_matcher"
If you are using remarkable, add this line to your spec_helper.rb :
    require "validates_cpf/remarkable/validate_as_cpf_matcher"

=== How?

You should use validates_as_cpf(: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 CPF and easy macros to test it.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
validates_cpf-0.2.1 README.rdoc