Sha256: d956f4e7cb6462935f0f2607e0fb14bcc61106cd2fb644ee46489674e67e9de6

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :inventory_unit, class: 'Spree::InventoryUnit' do
    transient do
      order { nil }
      stock_location { nil }
    end

    association :variant, strategy: :create
    line_item do
      if order
        build(:line_item, variant:, order:)
      else
        build(:line_item, variant:)
      end
    end
    state { 'on_hand' }
    shipment do
      if stock_location
        build(:shipment, state: 'pending', order: line_item.order, stock_location:)
      else
        build(:shipment, state: 'pending', order: line_item.order)
      end
    end
    # return_authorization
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_core-4.4.2 lib/spree/testing_support/factories/inventory_unit_factory.rb
solidus_core-4.4.1 lib/spree/testing_support/factories/inventory_unit_factory.rb
solidus_core-4.4.0 lib/spree/testing_support/factories/inventory_unit_factory.rb