Skip to content

Instantly share code, notes, and snippets.

@jcasimir
Created June 30, 2011 19:19
Show Gist options
  • Save jcasimir/1056988 to your computer and use it in GitHub Desktop.
Save jcasimir/1056988 to your computer and use it in GitHub Desktop.
Fabricate(:person) do
ssn { sequence(:ssn, 111111111) }
email { sequence(:email) { |i| "user#{i}@example.com" } }
end
# Sometimes I do this...
people = []
3.times{ people << Fabricate(:person) }
# Which seems like too much work. What do you think about something like...
Fabricate(:person, 3) # returns an array of 3 Person instances
# Other ideas:
Fabricate(:person).quantity(3)
Fabricate(3, :person)
Fabricate(3, :people)
Fabricate(:person) do
ssn { sequence(111111111) }
email { sequence{ |i| "user#{i}@example.com" } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment