Sha256: 943ed98f7e2e99c59c0109730b98749bd309d906d91ccd7eab5b1c416b18625a

Contents?: true

Size: 506 Bytes

Versions: 4

Compression:

Stored size: 506 Bytes

Contents

FactoryBot.define do
  factory :reimbursement, class: Spree::Reimbursement do
    transient do
      return_items_count 1
    end

    customer_return { create(:customer_return_with_accepted_items, line_items_count: return_items_count) }

    before(:create) do |reimbursement, evaluator|
      reimbursement.order ||= reimbursement.customer_return.order
      if reimbursement.return_items.empty?
        reimbursement.return_items = reimbursement.customer_return.return_items
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-3.2.9 lib/spree/testing_support/factories/reimbursement_factory.rb
spree_core-3.3.6 lib/spree/testing_support/factories/reimbursement_factory.rb
spree_core-3.2.8 lib/spree/testing_support/factories/reimbursement_factory.rb
spree_core-3.3.5 lib/spree/testing_support/factories/reimbursement_factory.rb