mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
parent
f33a64e0d1
commit
71dacea387
1 changed files with 12 additions and 0 deletions
|
@ -190,6 +190,18 @@ a particular factory:
|
|||
sequence(:email) {|n| "person#{n}@example.com" }
|
||||
end
|
||||
|
||||
You can also override the initial value:
|
||||
|
||||
factory :user do
|
||||
sequence(:email, 1000) {|n| "person#{n}@example.com" }
|
||||
end
|
||||
|
||||
Without a block, the value will increment itself, starting at its initial value:
|
||||
|
||||
factory :post do
|
||||
sequence(:position)
|
||||
end
|
||||
|
||||
Callbacks
|
||||
---------
|
||||
|
||||
|
|
Loading…
Reference in a new issue