I am using FactoryGirl to create a "Specialty" model that has a unique index on the code
column.
When I create multiple factories of the "Specialty" model I get this error:
Failure/Error: Factory(:specialty)
Mysql::Error: Duplicate entry 'AN00' for key 'index_specialties_on_code': INSERT INTO `specialties` (`code`, `name`) VALUES ('AN00', 'Name')
Duplicate entry 'AN00' for key 'index_specialties_on_code'
What's the right way to deal with this? How come the index associated with the model is not blown away with the model. I am using DatabaseCleaner.