Closed alencarandre closed 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.
Are you generating the number inside a block? Something like cpf { CPF.generate }. Otherwise, you'll get the same document on every instance.
cpf { CPF.generate }
No. I'm gonna do that.
Thanks
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.