From c58f893c0c31344a4340be0b82ff95a9d4ccabe9 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Fri, 3 Nov 2017 09:52:46 -0400 Subject: [PATCH] Document rewinding sequences --- GETTING_STARTED.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 8b5c343..c40c2bc 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -572,6 +572,22 @@ end The value just needs to support the `#next` method. Here the next value will be 'a', then 'b', etc. +Sequences can also be rewound with `FactoryBot.rewind_sequences`: + +```ruby +sequence(:email) {|n| "person#{n}@example.com" } + +generate(:email) # "person1@example.com" +generate(:email) # "person2@example.com" +generate(:email) # "person3@example.com" + +FactoryBot.rewind_sequences + +generate(:email) # "person1@example.com" +``` + +This rewinds all registered sequences. + Traits ------