Inline sequences
And it's also possible to define an in-line sequence that is only used in a particular factory:
factory :user do
sequence(:email) { |n| "person#{n}@example.com" }
end
With Ruby 2.7's support for numbered parameters, inline definitions can be even more abbreviated:
factory :user do
sequence(:email) { "person#{_1}@example.com" }
end