Sha256: 19c60bea937bb35cda991dab3e608ecf7d6b7c8f9ba39ef85f80ce88efc54669

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

FactoryGirl.define do
  factory :base_variant, :class => Spree::Variant do
    price 19.99
    cost_price 17.00
    sku    { Faker::Lorem.sentence }
    weight { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
    height { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
    width  { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
    depth  { BigDecimal.new("#{rand(200)}.#{rand(99)}") }

    # associations:
    product { |p| p.association(:base_product) }
    option_values { [FactoryGirl.create(:option_value)] }
  end

  factory :variant, :parent => :base_variant do
    on_hand 5
    
    # associations:
    product { |p| p.association(:product) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_core-1.3.2 lib/spree/core/testing_support/factories/variant_factory.rb