Or is it an external stone needed to generate random and unique usernames?
Here is my current factory:
factory :user_4 do sequence(:id) { |n| n } sequence(:first_name) { |n| "Gemini" + n.to_s } sequence(:last_name) { |n| "Pollux" + n.to_s } sequence(:profile_name) { |n| "GeminiPollux" + n.to_s } sequence(:email) { |n| "geminipollus" + n.to_s + "@hotmail.co.uk" } end
Using the sequence method works for id, profile_name and email, but my REGEX checks mean that the first name and surname are automatically invalid because they have a digit in them. Nothing to do with uniqueness.
So how do I create these unique names?
ruby ruby-on-rails factory-bot
Starkers
source share