How can I reset a factory_girl sequence?

后端 未结 9 1929
梦毁少年i
梦毁少年i 2020-12-16 10:17

Provided that I have a project factory

Factory.define :project do |p|
  p.sequence(:title)    { |n| \"project #{n} title\"                  }
  p.sequence(:         


        
9条回答
  •  离开以前
    2020-12-16 11:04

    If you are using Cucumber you can add this to a step definition:

    Given(/^I reload FactoryGirl/) do
      FactoryGirl.reload
    end
    

    Then just call it when needed.

提交回复
热议问题