From e7c2b52f52805114fc54ac14d109de5e8a0ccac2 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 7 Nov 2023 19:48:47 +0000 Subject: [PATCH] Updates pending example ..however: creating and deleting adjustments are still not passing when can_update_latest_invoice? is called over the order. @abdellani, I think I need your help on this one, I was not able to progress any further --- spec/services/order_invoice_comparator_spec.rb | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 5965e8dea8..e56d4293b0 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -96,25 +96,23 @@ shared_examples "attribute changes - note" do |boolean, type| end shared_examples "associated attribute changes - adjustments (create)" do |boolean, type| - before { order.adjustments << create(:adjustment, order:) } context "creating an adjustment" do + before { order.adjustments << create(:adjustment, order:) } it "returns #{boolean} if a #{type} attribute changes" do expect(subject).to be boolean end end - context "with an existing adjustment" do - before { order.adjustments << create(:adjustment, order:) } - + context "with an existing adjustments" do context "editing the amount" do - before { order.adjustments.first.update!(amount: 123) } + before { Spree::Adjustment.first.update!(amount: 123) } it "returns #{boolean} if a #{type} attribute changes" do expect(subject).to be boolean end end context "changing the adjustment type" do - before { order.adjustments.first.update!(adjustable_type: "Spree::Payment") } + before { Spree::Adjustment.first.update!(adjustable_type: "Spree::Shipment") } it "returns #{boolean} if a #{type} attribute changes" do expect(subject).to be boolean end @@ -123,7 +121,6 @@ shared_examples "associated attribute changes - adjustments (create)" do |boolea context "deleting an adjustment" do before { order.all_adjustments.destroy_all } it "returns #{boolean} if a #{type} attribute changes" do - order.reload expect(subject).to be boolean end end @@ -379,14 +376,12 @@ describe OrderInvoiceComparator do it_behaves_like "attribute changes - shipping method", false, "non-relevant" it_behaves_like "no attribute changes" it_behaves_like "associated attribute changes - adjustments (create)", false, - "non-relevant" do - before { pending } - end + "non-relevant" it_behaves_like "associated attribute changes - line items", false, "non-relevant" it_behaves_like "associated attribute changes - bill address", false, "non-relevant" it_behaves_like "associated attribute changes - ship address", false, "non-relevant" it_behaves_like "associated attribute changes - payments", false, - "non-relevant" do |_variable| + "non-relevant" do before { pending } end end