Sha256: e9c8c5db93a254456b9fe0473146fabf940bee8088e02b3122091a317a5986a1

Contents?: true

Size: 640 Bytes

Versions: 52

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

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

52 entries across 52 versions & 2 rubygems

Version Path
solidus_core-2.10.5 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.11.3 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.11.2 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.11.1 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.10.3 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.11.0 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.10.2 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.9.6 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.8.6 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.10.1 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.9.5 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.10.0 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.9.4 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.6.6 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.7.4 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.8.5 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.9.3 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.9.2 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.10.0.beta1 lib/spree/testing_support/factories/carton_factory.rb
solidus_core-2.7.3 lib/spree/testing_support/factories/carton_factory.rb