Sha256: ff22546c85e9ec7de1592310a3676e32961227c02a9235c375d3c195ea3647f6

Contents?: true

Size: 665 Bytes

Versions: 4

Compression:

Stored size: 665 Bytes

Contents

require 'spree/testing_support/factories/line_item_factory'
require 'spree/testing_support/factories/variant_factory'
require 'spree/testing_support/factories/order_factory'
require 'spree/testing_support/factories/shipment_factory'

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_core-2.5.0 lib/spree/testing_support/factories/inventory_unit_factory.rb
solidus_core-2.5.0.rc1 lib/spree/testing_support/factories/inventory_unit_factory.rb
solidus_core-2.5.0.beta2 lib/spree/testing_support/factories/inventory_unit_factory.rb
solidus_core-2.5.0.beta1 lib/spree/testing_support/factories/inventory_unit_factory.rb