Sha256: 6daaa1e5e297b807542fa8b34df8eba3c2ca9077ba72982a45d5204e82e79ecc
Contents?: true
Size: 1001 Bytes
Versions: 2
Compression:
Stored size: 1001 Bytes
Contents
FactoryGirl.define do factory :customer_return, class: Spree::CustomerReturn do association(:stock_location, factory: :stock_location) ignore do line_items_count 1 return_items_count { line_items_count } end before(:create) do |customer_return, evaluator| shipped_order = create(:shipped_order, line_items_count: evaluator.line_items_count) shipped_order.inventory_units.take(evaluator.return_items_count).each do |inventory_unit| customer_return.return_items << build(:return_item, inventory_unit: inventory_unit) end end factory :customer_return_with_accepted_items do after(:create) do |customer_return| customer_return.return_items.each(&:accept!) end end end # for the case when you want to supply existing return items instead of generating some factory :customer_return_without_return_items, class: Spree::CustomerReturn do association(:stock_location, factory: :stock_location) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_core-2.4.0.rc2 | lib/spree/testing_support/factories/customer_return_factory.rb |
spree_core-2.4.0.rc1 | lib/spree/testing_support/factories/customer_return_factory.rb |