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

前端 未结 7 2065
暗喜
暗喜 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

    You might also find it's because you haven't wrapped the statement in:

    describe "what it should do" do
      @static_model = Factory(:state) # with validate uniqueness of state name
    end
    

    I discovered that was the change that solved this problem: Why isn't factory_girl operating transactionally for me? - rows remain in database after tests

提交回复
热议问题