Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass stock location to inventory unit factory #3375

Merged
merged 1 commit into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
factory :inventory_unit, class: 'Spree::InventoryUnit' do
transient do
order { nil }
stock_location { nil }
end

variant
Expand All @@ -20,7 +21,13 @@
end
end
state { 'on_hand' }
shipment { build(:shipment, state: 'pending', order: line_item.order) }
shipment do
if stock_location
build(:shipment, state: 'pending', order: line_item.order, stock_location: stock_location)
else
build(:shipment, state: 'pending', order: line_item.order)
end
end
# return_authorization
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

after(:build) do |package, evaluator|
evaluator.variants_contents.each do |variant, count|
package.add_multiple build_list(:inventory_unit, count, variant: variant)
package.add_multiple build_list(:inventory_unit, count, variant: variant, stock_location: evaluator.stock_location)
end
end

Expand Down