Sha256: d3755fc299bd22ecfe23cd82a75d228696387b4f01af38bc7f774a26fa1c51c2

Contents?: true

Size: 466 Bytes

Versions: 9

Compression:

Stored size: 466 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.cost_price 17.00
  f.sku "ABC"
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree-0.11.4 test/factories/product_factory.rb
spree-0.11.3 test/factories/product_factory.rb
spree-0.11.2 test/factories/product_factory.rb
spree-0.11.1 test/factories/product_factory.rb
spree-0.11.0 test/factories/product_factory.rb
spree-0.10.2 test/factories/product_factory.rb
spree-0.10.1 test/factories/product_factory.rb
spree-0.10.0 test/factories/product_factory.rb
spree-0.10.0.beta test/factories/product_factory.rb