开发者

Factory_girl data is not being cleaned up

开发者 https://www.devze.com 2023-02-25 13:02 出处:网络
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 bec

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号