Skip to content

Instantly share code, notes, and snippets.

@kirkconnell
Created February 19, 2011 00:41
Show Gist options
  • Save kirkconnell/834683 to your computer and use it in GitHub Desktop.
Save kirkconnell/834683 to your computer and use it in GitHub Desktop.
Factory.define :seattle_profile_with_products, :parent => :profile do |f|
f.primary_address { Factory.create(:primary_address) }
f.profile_type do
pt = ProfileType.find_by_name('County Profile')
pt ||= Factory.create(:profile_type, :name => "County Profile")
end
f.after_create do |profile|
Factory.create :seattle_loc
Factory.create :seattle_zip_loc
product = Factory.create(:product_in_king_county, :site => profile.site)
profile.locations << product.locations
profile.entity.products << product
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment