Created
September 7, 2008 15:34
-
-
Save mattetti/9269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Client factory | |
Factory.define :client do |c| | |
c.name 'John Doe' | |
c.email{|c| "#{(c.name || "John Doe").split(' ').first}.#{(c.name || "John Doe").split(' ').last}@email.com".downcase} | |
c.address "1234 DrPepper Road" | |
c.city "San Diego" | |
c.zip_code "92129" | |
c.phone "858-555-1234" | |
c.created_at Time.now | |
end | |
# Project factory | |
Factory.define :project do |p| | |
p.name "John's project" | |
p.association :client, :factory => :client | |
p.done false | |
p.note 'a note' | |
p.created_at Time.now | |
p.due_date {|p| p.created_at + 10.days} | |
p.estimated_budget { (5_000..40_000).to_a[rand(35_000)] } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment