Last Updated: February 25, 2016
·
703
· alxndr

test uniqueness in your factories

If you're testing your factories, you may also want to check that they are generating unique attributes. To fail tests when I'm not validating uniqueness, I added a second build inside the loop (along with a way to skip any factories for models that there should never be two of):

https://gist.github.com/4053301