Sha256: b3dd0cd83312599c3d2771133cd0dca16c355f4847dbe0c47ee62888d5180775

Contents?: true

Size: 447 Bytes

Versions: 6

Compression:

Stored size: 447 Bytes

Contents

Factory.sequence(:product_sequence) {|n| "Product ##{n} - #{rand(9999)}"}

Factory.define :product do |f|
  f.name { Factory.next(:product_sequence) }
  f.description { Faker::Lorem.paragraphs(rand(5)+1).join("\n") }

  # associations:
  f.tax_category {|r| TaxCategory.find(:first) || r.association(:tax_category)}
  f.shipping_category {|r| ShippingCategory.find(:first) || r.association(:shipping_category)}
  
  f.price 19.99
  f.sku "ABC"
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree-enriquez-0.9.4 test/factories/product_factory.rb
spree-0.9.4 test/factories/product_factory.rb
spree-0.9.3 test/factories/product_factory.rb
spree-0.9.2 test/factories/product_factory.rb
spree-0.9.1 test/factories/product_factory.rb
spree-0.9.0 test/factories/product_factory.rb