Sha256: a77aa35fc3985c762b8ded5f8ee12e87b206bbf18c04a0a07e425a2c89183437
Contents?: true
Size: 678 Bytes
Versions: 5
Compression:
Stored size: 678 Bytes
Contents
# frozen_string_literal: true FactoryBot.define do factory :stock_package, class: 'Spree::Stock::Package' do skip_create transient do stock_location { build(:stock_location) } contents { [] } variants_contents { {} } end initialize_with { new(stock_location, contents) } after(:build) do |package, evaluator| evaluator.variants_contents.each do |variant, count| package.add_multiple build_list(:inventory_unit, count, variant:, stock_location: evaluator.stock_location) end end factory :stock_package_fulfilled do transient { variants_contents { { build(:variant) => 2 } } } end end end
Version data entries
5 entries across 5 versions & 1 rubygems