Sha256: 617b16d3c9ab1f58ee08f44ca134e277f023b28867bdf4d491e09c05daf756f6
Contents?: true
Size: 1002 Bytes
Versions: 4
Compression:
Stored size: 1002 Bytes
Contents
FactoryGirl.define do factory :customer_return, class: Spree::CustomerReturn do association(:stock_location, factory: :stock_location) transient 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
4 entries across 4 versions & 1 rubygems