Sha256: 648ac9fd253969a97523042a299b6b5102820b05ab3fba2958e9ae7494babc34

Contents?: true

Size: 860 Bytes

Versions: 32

Compression:

Stored size: 860 Bytes

Contents

require 'spree/testing_support/factories/inventory_unit_factory'
require 'spree/testing_support/factories/return_reason_factory'
require 'spree/testing_support/factories/return_authorization_factory'

FactoryGirl.define do
  factory :return_item, class: Spree::ReturnItem do
    association(:inventory_unit, factory: :inventory_unit, state: :shipped)
    association(:return_reason, factory: :return_reason)
    return_authorization do |_return_item|
      build(:return_authorization, order: inventory_unit.order)
    end

    factory :exchange_return_item do
      after(:build) do |return_item|
        # set track_inventory to false to ensure it passes the in_stock check
        return_item.inventory_unit.variant.update_column(:track_inventory, false)
        return_item.exchange_variant = return_item.inventory_unit.variant
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.2.2 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.1.1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.0.3 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-1.4.2 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-1.3.2 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.3.0 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.3.0.rc3 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.3.0.rc2 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.3.0.rc1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.3.0.beta1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.0.2 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-1.4.1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.2.1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.2.0 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.2.0.rc1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.2.0.beta1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.1.0 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.1.0.rc1 lib/spree/testing_support/factories/return_item_factory.rb
solidus_core-2.0.1 lib/spree/testing_support/factories/return_item_factory.rb