Factory_girl data is not being cleaned up
I am using factory girl for test data. I create a user object in a before(:each) block, and it runs through a few expectations just fine. If i run the tests again, the validation on the model fail because they require a unique username. The test data from the previous run is still there. I know a cleanup task is required when using before(:all), but since im using开发者_StackOverflow before(:each), does it not get cleaned up?
It had to do with how I was using factory girl objects, and my tests. In some of the tests, other rows were being written to the database. I stubbed out some of the create calls, and also fixed up how I was using the factory girl objects.
精彩评论