Sha256: e0f161a2ec1a7c2379feff2b505e1359afb82718327e995eb65b7fc3818bc955

Contents?: true

Size: 579 Bytes

Versions: 16

Compression:

Stored size: 579 Bytes

Contents

FactoryBot.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(
            order_id: shipment.order_id,
            variant_id: line_item.variant_id,
            line_item_id: line_item.id
          )
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spree_core-3.4.6 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.6 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.5 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.4 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.3 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.2 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.1 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.0 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.5.0 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.6.0.rc1 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.5.0.rc2 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.5.0.rc1 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.4.5 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.4.4 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.4.3 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-3.4.2 lib/spree/testing_support/factories/shipment_factory.rb