Sha256: 2d2d2c37e9d58bfa114d68ec4b05229d05ff275ebed586fa36d81c6bc8874ed0

Contents?: true

Size: 538 Bytes

Versions: 10

Compression:

Stored size: 538 Bytes

Contents

FactoryGirl.define do
  factory :shipment, class: Spree::Shipment do
    tracking 'U10000'
    cost 100.00
    state 'pending'
    order
    stock_location

    after(:create) do |shipment, evalulator|
      shipment.add_shipping_method(create(:shipping_method), true)

      shipment.order.line_items.each do |line_item|
        line_item.quantity.times do
          shipment.inventory_units.create(
            variant_id: line_item.variant_id,
            line_item_id: line_item.id
          )
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_core-2.3.13 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.12 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.11 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.10 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.9 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.8 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.7 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.6 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.5 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.3.4 lib/spree/testing_support/factories/shipment_factory.rb