Sha256: 5a102a4d7d0c0f8f6102c89c099d15d997edbdce7469ca53e88e53792801e50e

Contents?: true

Size: 567 Bytes

Versions: 15

Compression:

Stored size: 567 Bytes

Contents

FactoryGirl.define do
  factory :shipment, class: Spree::Shipment do
    tracking 'U10000'
    number '100'
    cost 100.00
    state 'pending'
    order
    address
    stock_location

    after(:create) do |shipment, evalulator|
      shipment.add_shipping_method(create(:shipping_method), true)

      shipment.order.line_items.each do |line_item|
        line_item.quantity.times do
          shipment.inventory_units.create(
            variant_id: line_item.variant_id,
            line_item_id: line_item.id
          )
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spree_core-2.2.14 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.13 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.12 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.11 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.10 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.9 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.8 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.7 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.6 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.5 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.4 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.3 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.2 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.1 lib/spree/testing_support/factories/shipment_factory.rb
spree_core-2.2.0 lib/spree/testing_support/factories/shipment_factory.rb