fnando / cpf_cnpj

🇧🇷 Validate, generate and format CPF/CNPJ numbers. Include command-line tools.
MIT License
238 stars 42 forks source link

Not generate unique when use generate #9

Closed alencarandre closed 6 years ago

alencarandre commented 6 years ago

In my model, I create unique index for CPF/CNPJ, and when I use CPF/CNPJ.generate in RSpec, not generate unique CPF/CPNJ and give validation error in Factory.

fnando commented 6 years ago

Are you generating the number inside a block? Something like cpf { CPF.generate }. Otherwise, you'll get the same document on every instance.

alencarandre commented 6 years ago

No. I'm gonna do that.

Thanks