Sha256: 688ec45b794e30e0d29cad43e08c05a99f417a5e7076f937e1716dafeba34955

Contents?: true

Size: 385 Bytes

Versions: 26

Compression:

Stored size: 385 Bytes

Contents

FactoryBot.define do
  factory :stock_item, class: Spree::StockItem do
    backorderable { true }
    stock_location
    variant

    before(:create) do |stock_item|
      Spree::StockItem.find_by(
        variant: stock_item.variant,
        stock_location: stock_item.stock_location
      )&.destroy
    end

    after(:create) { |object| object.adjust_count_on_hand(10) }
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
spree_core-4.10.1 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.10.0 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.9.0 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.8.3 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.8.2 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.7.3 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.6.6 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.5.5 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.4.1 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.5.4 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.6.5 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.7.2 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.7.1 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.6.4 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.7.0 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.6.3 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.6.2 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.6.1 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.6.0 lib/spree/testing_support/factories/stock_item_factory.rb
spree_core-4.5.3 lib/spree/testing_support/factories/stock_item_factory.rb