Provided that I have a project factory
Factory.define :project do |p|
p.sequence(:title) { |n| \"project #{n} title\" }
p.sequence(:
This is pretty old, but it's the top result on google for the relevant keywords. For anyone else stumbling across this.
There is a class method called sequence_by_name
to fetch a sequence by name, and then you can call rewind
and it'll reset to 1.
FactoryBot.sequence_by_name(:order).rewind
Or if you want to reset all.
FactoryBot.rewind_sequences
Here is the link to the file on github