Sha256: d01a62a7025721d846e6881f31557d1187c4b532d5fc9ea88aaabaf471e96f00

Contents?: true

Size: 609 Bytes

Versions: 6

Compression:

Stored size: 609 Bytes

Contents

require 'spree/testing_support/factories/shipment_factory'
require 'spree/testing_support/factories/inventory_unit_factory'

FactoryBot.define do
  factory :carton, class: 'Spree::Carton' do
    address
    stock_location
    shipping_method
    shipped_at { Time.current }
    inventory_units do
      [
        build(
          :inventory_unit,
          # ensure the shipment uses the same stock location as the carton
          shipment: build(
            :shipment,
            stock_location: stock_location,
            shipping_method: shipping_method
          )
        )
      ]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_core-2.5.2 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.5.1 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.5.0 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.5.0.rc1 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.5.0.beta2 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.5.0.beta1 lib/spree/testing_support/factories/carton_factory.rb