Document rewinding sequences

This commit is contained in:
Joshua Clayton 2017-11-03 09:52:46 -04:00
parent 50eeb67241
commit c58f893c0c
No known key found for this signature in database
GPG Key ID: 5B6558F77E9A8118
1 changed files with 16 additions and 0 deletions

View File

@ -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
------