factory_girl + rspec doesn't seem to roll back changes after each example

前端 未结 7 2080
暗喜
暗喜 2021-02-07 05:39

Similar to the problem described here: http://rpheath.com/posts/411-how-to-use-factory-girl-with-rspec

in Short (shorten\'d code):

spec_helper:

c         


        
7条回答
  •  悲哀的现实
    2021-02-07 06:27

    When you use Factory(:state) wich is a shortcut to Factory.create(:state), factory_girl returns you a saved object.

    Use Factory.build(:state) instead.

提交回复
热议问题