From ee1611904ba080ab1f542e171897718516c68ebe Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 21 Sep 2023 16:32:06 +1000 Subject: [PATCH 1/2] Fix typos in spec description --- spec/services/order_invoice_comparator_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 6ee0fa7341..5f587705e3 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -51,7 +51,7 @@ describe OrderInvoiceComparator do end end - it "returns returns true" do + it "returns true" do Spree::TaxRate.first.update!(amount: 0.15) order.create_tax_charge! order.reload @@ -69,7 +69,7 @@ describe OrderInvoiceComparator do end end - it "returns returns true" do + it "returns true" do Spree::TaxRate.first.update!(amount: 0.15) order.create_tax_charge! order.reload @@ -79,7 +79,7 @@ describe OrderInvoiceComparator do context "shipping method changes" do let(:shipping_method) { create(:shipping_method) } - it "returns returns true" do + it "returns true" do Spree::ShippingRate.first.update(shipping_method_id: shipping_method.id) expect(subject).to be true end @@ -145,7 +145,7 @@ describe OrderInvoiceComparator do } context "changes on the order object" do - it "returns true if the order didn't change" do + it "returns false if the order didn't change" do expect(subject).to be false end From 6386a997d3805c4de5ad8f3cbf1b6979b4dc4dce Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 21 Sep 2023 16:33:50 +1000 Subject: [PATCH 2/2] Compare adjustments in deterministic order for invoices The comparator would sometimes compare two different adjustments when it should have compared two versions of the same adjustment. --- app/serializers/invoice/order_serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/serializers/invoice/order_serializer.rb b/app/serializers/invoice/order_serializer.rb index dbdde2d03f..a5551779e0 100644 --- a/app/serializers/invoice/order_serializer.rb +++ b/app/serializers/invoice/order_serializer.rb @@ -16,7 +16,7 @@ class Invoice has_many :all_eligible_adjustments, serializer: Invoice::AdjustmentSerializer def all_eligible_adjustments - object.all_adjustments.eligible + object.all_adjustments.eligible.order(:id) end def completed_at