From 5a2155aeb708c76a852dc8a6f978daca6bacc7a5 Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Tue, 15 Aug 2023 11:33:02 +1000 Subject: [PATCH] Use the same sorting when choosing a line item to update The presenter uses order.sorted_line_items, so use the same method when picking up the line item to update. --- spec/services/invoice_data_generator_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/services/invoice_data_generator_spec.rb b/spec/services/invoice_data_generator_spec.rb index cc014cc312..de9174ac73 100644 --- a/spec/services/invoice_data_generator_spec.rb +++ b/spec/services/invoice_data_generator_spec.rb @@ -54,7 +54,7 @@ describe InvoiceDataGenerator do context "line items" do it "should reflect the changes" do - line_item = order.line_items.first + line_item = order.sorted_line_items.first new_quantity = line_item.quantity + 1 line_item.update!(quantity: new_quantity) @@ -62,7 +62,7 @@ describe InvoiceDataGenerator do end it "should not reflect variant changes" do - line_item = order.line_items.first + line_item = order.sorted_line_items.first old_variant_name = line_item.variant.display_name line_item.variant.update!(display_name: "NEW NAME")