Skip to content

Instantly share code, notes, and snippets.

@coffeeaddict
Created May 27, 2011 13:50
Show Gist options
  • Save coffeeaddict/995285 to your computer and use it in GitHub Desktop.
Save coffeeaddict/995285 to your computer and use it in GitHub Desktop.
Factories with randomness
require 'rufus-mnemo'
Factory.sequence :word do |n|
Rufus::Mnemo::from_integer(10000000 + n)
end
Factory.define :company do |r|
r.name { Factory.next :word }
end
Factory.define :user do |u|
u.email { Factory.next(:word) + "@hisdomain.org" }
u.password { Factory.next(:word) }
u.association :company, :factory => :company
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment