Created
August 10, 2009 18:41
-
-
Save joshuaclayton/165346 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Factory.define(:product) do |product| | |
product.association :creator, :factory => :product_admin_user | |
product.association :product_template | |
product.product_variant do |p| | |
Factory(:product_variant, :product_template => p.product_template) | |
end | |
product.sequence(:name) {|n| "Product #{n}" } | |
product.sequence(:part_number) {|n| "Part Number #{n}" } | |
product.formed_price { "$99.50" } | |
end | |
Factory.define(:standard_product, :class => StandardProduct, :parent => :product) do |product| | |
product.list_item do |p| | |
# this doesn't work because product_variant hasn't been added as an attribute yet | |
Factory(:list_item, :product_variant => p.product_variant) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment