Skip to content

Commit

Permalink
Update spec to properly update line items on an order
Browse files Browse the repository at this point in the history
User Order::Contents#update_item to update line item on an order, it
ensures the order is properly updated
  • Loading branch information
rioug authored and drummer83 committed Jan 9, 2025
1 parent 9d31b70 commit e2bfccd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions spec/system/admin/orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,15 @@

context "orders with different order totals" do
before do
Spree::LineItem.where(order_id: order2.id).first.update!(quantity: 5)
Spree::LineItem.where(order_id: order3.id).first.update!(quantity: 4)
Spree::LineItem.where(order_id: order4.id).first.update!(quantity: 3)
Spree::LineItem.where(order_id: order5.id).first.update!(quantity: 2)
order2.save
order3.save
order4.save
order5.save
order2.contents.update_item(Spree::LineItem.where(order_id: order2.id).first,
{ quantity: 5 })
order3.contents.update_item(Spree::LineItem.where(order_id: order3.id).first,
{ quantity: 4 })
order4.contents.update_item(Spree::LineItem.where(order_id: order4.id).first,
{ quantity: 3 })
order5.contents.update_item(Spree::LineItem.where(order_id: order5.id).first,
{ quantity: 2 })

login_as_admin
visit spree.admin_orders_path
end
Expand Down

0 comments on commit e2bfccd

Please sign in to comment.