rfs / validates_cpf_cnpj

CPF and CNPJ validations for ActiveModel and Rails
35 stars 21 forks source link

Some well know invalid numbers are not considered invalid by the algorithm #1

Closed brodock closed 11 years ago

brodock commented 12 years ago

There are some well know invalid numbers like: 11111111111 that are considered valid by the algorithm, and should not.

At this pull request I added then to the rspec test and also dried the test a little.

Hope you find it useful.

brodock commented 12 years ago

I've appended another modification on b49fffc because my rspec tests on another application were not recognizing the validations without workarounds (like forcing save). Looking at Rails validations defaults, they do choose to not specify :on configuration, so I suggest it as a better default value.

Cheers.