From 8d382f3de4d39b19b4bc392d87be16ef782361e9 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 31 Jul 2023 13:06:47 +0100 Subject: [PATCH 01/14] Corrects description for order-level, non-relevant attribute change --- spec/services/order_invoice_comparator_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 778bd769ae..ee9c02c388 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -26,7 +26,7 @@ describe OrderInvoiceComparator do expect(subject).to be true end - it "returns true if a non-relevant attribute changes" do + it "returns false if a non-relevant attribute changes" do order.update!(note: "THIS IS A NEW NOTE") expect(subject).to be false end From 054054889334257325e3d187ed293e56a9a83a37 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 31 Jul 2023 14:56:55 +0100 Subject: [PATCH 02/14] Adds coverage for included/added taxes at the order-object level --- .../services/order_invoice_comparator_spec.rb | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index ee9c02c388..3c166f485f 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -30,6 +30,52 @@ describe OrderInvoiceComparator do order.update!(note: "THIS IS A NEW NOTE") expect(subject).to be false end + + context "additional tax total changes" do + let(:distributor) { create(:distributor_enterprise) } + let!(:order_with_taxes) do + create(:order_with_taxes, distributor: distributor, ship_address: create(:address), + product_price: 110, tax_rate_amount: 0.1, included_in_price: false, + tax_rate_name: "Tax 1").tap do |order| + order.create_tax_charge! + order.update_shipping_fees! + end + end + + + it "returns returns true if additional tax total changes" do + + expect(order_with_taxes.additional_tax_total).to eq 0.11e2 + Spree::TaxRate.first.update!(amount: 0.15) + order_with_taxes.create_tax_charge! && order_with_taxes.save + + expect(order_with_taxes.additional_tax_total).to eq 0.165e2 + + expect(subject).to be true + end + end + + context "included tax total changes" do + let(:distributor) { create(:distributor_enterprise) } + let!(:order_with_taxes) do + create(:order_with_taxes, distributor: distributor, ship_address: create(:address), + product_price: 110, tax_rate_amount: 0.1, included_in_price: true, + tax_rate_name: "Tax 1").tap do |order| + order.create_tax_charge! + order.update_shipping_fees! + end + end + + it "returns returns true if included_tax_total changes" do + expect(order_with_taxes.included_tax_total).to eq 0.1e2 + Spree::TaxRate.first.update!(amount: 0.15) + order_with_taxes.create_tax_charge! && order_with_taxes.save + + expect(order_with_taxes.included_tax_total).to eq 0.1435e2 + + expect(subject).to be true + end + end end context "a non-relevant associated model is updated" do From a223675e7459b0d061d4c28e60e09bd55abc6d26 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 31 Jul 2023 16:30:26 +0100 Subject: [PATCH 03/14] Covers shipping method change --- .../services/order_invoice_comparator_spec.rb | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 3c166f485f..b6c6bd7276 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -42,9 +42,7 @@ describe OrderInvoiceComparator do end end - - it "returns returns true if additional tax total changes" do - + it "returns returns true" do expect(order_with_taxes.additional_tax_total).to eq 0.11e2 Spree::TaxRate.first.update!(amount: 0.15) order_with_taxes.create_tax_charge! && order_with_taxes.save @@ -59,23 +57,36 @@ describe OrderInvoiceComparator do let(:distributor) { create(:distributor_enterprise) } let!(:order_with_taxes) do create(:order_with_taxes, distributor: distributor, ship_address: create(:address), - product_price: 110, tax_rate_amount: 0.1, included_in_price: true, + product_price: 110, tax_rate_amount: 0.1, + included_in_price: true, tax_rate_name: "Tax 1").tap do |order| order.create_tax_charge! order.update_shipping_fees! end end - it "returns returns true if included_tax_total changes" do + it "returns returns true" do expect(order_with_taxes.included_tax_total).to eq 0.1e2 Spree::TaxRate.first.update!(amount: 0.15) order_with_taxes.create_tax_charge! && order_with_taxes.save - + expect(order_with_taxes.included_tax_total).to eq 0.1435e2 expect(subject).to be true end end + + context "shipping method changes" do + let(:shipping_method) { create(:shipping_method) } + let!(:order_ready_to_ship) { + create(:order_ready_to_ship) + } + it "returns returns true" do + Spree::ShippingRate.first.update(shipping_method_id: shipping_method.id) + order_ready_to_ship.update_shipping_fees! && order_ready_to_ship.save + expect(subject).to be true + end + end end context "a non-relevant associated model is updated" do From 79a38345e9d2cd7b8cfdec6165ae8d641a9dcd94 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 2 Aug 2023 15:08:19 +0100 Subject: [PATCH 04/14] Passes order as argument to invoice comparator --- .../services/order_invoice_comparator_spec.rb | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index b6c6bd7276..3d904a0b22 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -4,7 +4,9 @@ require 'spec_helper' describe OrderInvoiceComparator do describe '#can_generate_new_invoice?' do - let!(:order) { create(:completed_order_with_fees) } + let!(:completed_order_with_fees) { create(:completed_order_with_fees) } + # this passes 'order' as argument to the invoice comparator + let(:order) { completed_order_with_fees } let!(:invoice_data_generator){ InvoiceDataGenerator.new(order) } let!(:invoice){ create(:invoice, @@ -35,20 +37,18 @@ describe OrderInvoiceComparator do let(:distributor) { create(:distributor_enterprise) } let!(:order_with_taxes) do create(:order_with_taxes, distributor: distributor, ship_address: create(:address), - product_price: 110, tax_rate_amount: 0.1, included_in_price: false, + product_price: 110, tax_rate_amount: 0.1, + included_in_price: false, tax_rate_name: "Tax 1").tap do |order| order.create_tax_charge! order.update_shipping_fees! end end + let!(:order) { order_with_taxes } it "returns returns true" do - expect(order_with_taxes.additional_tax_total).to eq 0.11e2 Spree::TaxRate.first.update!(amount: 0.15) order_with_taxes.create_tax_charge! && order_with_taxes.save - - expect(order_with_taxes.additional_tax_total).to eq 0.165e2 - expect(subject).to be true end end @@ -64,26 +64,20 @@ describe OrderInvoiceComparator do order.update_shipping_fees! end end + let!(:order) { order_with_taxes } it "returns returns true" do - expect(order_with_taxes.included_tax_total).to eq 0.1e2 Spree::TaxRate.first.update!(amount: 0.15) order_with_taxes.create_tax_charge! && order_with_taxes.save - - expect(order_with_taxes.included_tax_total).to eq 0.1435e2 - expect(subject).to be true end end context "shipping method changes" do let(:shipping_method) { create(:shipping_method) } - let!(:order_ready_to_ship) { - create(:order_ready_to_ship) - } + let!(:order) { completed_order_with_fees } it "returns returns true" do Spree::ShippingRate.first.update(shipping_method_id: shipping_method.id) - order_ready_to_ship.update_shipping_fees! && order_ready_to_ship.save expect(subject).to be true end end From b0c362f75e70aa0023e5dfd630b031c4ae00ff72 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 30 Aug 2023 12:20:44 +0100 Subject: [PATCH 05/14] Corrects description, if the order didn't change --- spec/services/order_invoice_comparator_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 3d904a0b22..4bd124d77b 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -18,7 +18,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 38eb84b1d86fe11c94f283ae944efe1ba00e7d4d Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 30 Aug 2023 12:52:15 +0100 Subject: [PATCH 06/14] Covers order total change --- spec/services/order_invoice_comparator_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 4bd124d77b..c00c6e2098 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -28,6 +28,12 @@ describe OrderInvoiceComparator do expect(subject).to be true end + it "returns true if a relevant attribute changes" do + Spree::Order.where(id: order.id).update_all(total: order.total + 10) + order.reload + expect(subject).to be true + end + it "returns false if a non-relevant attribute changes" do order.update!(note: "THIS IS A NEW NOTE") expect(subject).to be false From 2e72fe1bcefb52a213794612092051fc21377e26 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 30 Aug 2023 12:56:58 +0100 Subject: [PATCH 07/14] Covers order number change --- spec/services/order_invoice_comparator_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index c00c6e2098..5675165559 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -34,6 +34,12 @@ describe OrderInvoiceComparator do expect(subject).to be true end + it "returns false if an attribute which should not change, changes" do + Spree::Order.where(id: order.id).update_all(number: 'R631504404') + order.reload + expect(subject).to be false + end + it "returns false if a non-relevant attribute changes" do order.update!(note: "THIS IS A NEW NOTE") expect(subject).to be false From 301c070fc3e70510206679608ac9226e0d71ed97 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 30 Aug 2023 12:59:11 +0100 Subject: [PATCH 08/14] Covers order currency change --- spec/services/order_invoice_comparator_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 5675165559..59b121c028 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -40,6 +40,12 @@ describe OrderInvoiceComparator do expect(subject).to be false end + it "returns false if an attribute which should not change, changes" do + Spree::Order.where(id: order.id).update_all(currency: 'EUR') + order.reload + expect(subject).to be false + end + it "returns false if a non-relevant attribute changes" do order.update!(note: "THIS IS A NEW NOTE") expect(subject).to be false From 3374c38d5c4d688e6fb9ff7b01f4bdfcd9003384 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 30 Aug 2023 13:18:06 +0100 Subject: [PATCH 09/14] Covers order state - cancelled, resumed - changes --- spec/services/order_invoice_comparator_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 59b121c028..22dd5cdb3f 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -46,6 +46,17 @@ describe OrderInvoiceComparator do expect(subject).to be false end + it "returns true if a relevant attribute changes - order state: cancelled" do + order.cancel! + expect(subject).to be true + end + + it "returns true if a relevant attribute changes - order state: resumed" do + order.cancel! + order.resume! + expect(subject).to be true + end + it "returns false if a non-relevant attribute changes" do order.update!(note: "THIS IS A NEW NOTE") expect(subject).to be false From e0031225d1be2ad43472d64f37ef905ce0524e80 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 30 Aug 2023 13:25:04 +0100 Subject: [PATCH 10/14] Covers order special instruction --- spec/services/order_invoice_comparator_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 22dd5cdb3f..86b26dc91f 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -57,6 +57,11 @@ describe OrderInvoiceComparator do expect(subject).to be true end + it "returns false if a non-relevant attribute changes" do + order.update!(special_instructions: "A very special insctruction.") + expect(subject).to be false + end + it "returns false if a non-relevant attribute changes" do order.update!(note: "THIS IS A NEW NOTE") expect(subject).to be false From 381ce1c2b906d411360af68baea7c8be12a79e94 Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 1 Sep 2023 12:00:29 +1000 Subject: [PATCH 11/14] Simplify order definition There only needs to be one order at a time, and it can be created on-demand. We can simply override it in the specs that need to. --- spec/services/order_invoice_comparator_spec.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 86b26dc91f..19b905d12b 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -4,9 +4,8 @@ require 'spec_helper' describe OrderInvoiceComparator do describe '#can_generate_new_invoice?' do - let!(:completed_order_with_fees) { create(:completed_order_with_fees) } # this passes 'order' as argument to the invoice comparator - let(:order) { completed_order_with_fees } + let(:order) { create(:completed_order_with_fees) } let!(:invoice_data_generator){ InvoiceDataGenerator.new(order) } let!(:invoice){ create(:invoice, @@ -69,7 +68,7 @@ describe OrderInvoiceComparator do context "additional tax total changes" do let(:distributor) { create(:distributor_enterprise) } - let!(:order_with_taxes) do + let(:order) do create(:order_with_taxes, distributor: distributor, ship_address: create(:address), product_price: 110, tax_rate_amount: 0.1, included_in_price: false, @@ -78,18 +77,17 @@ describe OrderInvoiceComparator do order.update_shipping_fees! end end - let!(:order) { order_with_taxes } it "returns returns true" do Spree::TaxRate.first.update!(amount: 0.15) - order_with_taxes.create_tax_charge! && order_with_taxes.save + order.create_tax_charge! && order.save expect(subject).to be true end end context "included tax total changes" do let(:distributor) { create(:distributor_enterprise) } - let!(:order_with_taxes) do + let(:order) do create(:order_with_taxes, distributor: distributor, ship_address: create(:address), product_price: 110, tax_rate_amount: 0.1, included_in_price: true, @@ -98,18 +96,16 @@ describe OrderInvoiceComparator do order.update_shipping_fees! end end - let!(:order) { order_with_taxes } it "returns returns true" do Spree::TaxRate.first.update!(amount: 0.15) - order_with_taxes.create_tax_charge! && order_with_taxes.save + order.create_tax_charge! && order.save expect(subject).to be true end end context "shipping method changes" do let(:shipping_method) { create(:shipping_method) } - let!(:order) { completed_order_with_fees } it "returns returns true" do Spree::ShippingRate.first.update(shipping_method_id: shipping_method.id) expect(subject).to be true From 32c0b5a3e26a347bc97e96773ef107762a055cec Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 1 Sep 2023 12:04:27 +1000 Subject: [PATCH 12/14] Remove unnecessary details As far as I can tell we didn't need to specify these for the tests. --- .../services/order_invoice_comparator_spec.rb | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 19b905d12b..4c05c814fa 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -67,15 +67,13 @@ describe OrderInvoiceComparator do end context "additional tax total changes" do - let(:distributor) { create(:distributor_enterprise) } let(:order) do - create(:order_with_taxes, distributor: distributor, ship_address: create(:address), - product_price: 110, tax_rate_amount: 0.1, - included_in_price: false, - tax_rate_name: "Tax 1").tap do |order| - order.create_tax_charge! - order.update_shipping_fees! - end + create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1, + included_in_price: false) + .tap do |order| + order.create_tax_charge! + order.update_shipping_fees! + end end it "returns returns true" do @@ -86,15 +84,13 @@ describe OrderInvoiceComparator do end context "included tax total changes" do - let(:distributor) { create(:distributor_enterprise) } let(:order) do - create(:order_with_taxes, distributor: distributor, ship_address: create(:address), - product_price: 110, tax_rate_amount: 0.1, - included_in_price: true, - tax_rate_name: "Tax 1").tap do |order| - order.create_tax_charge! - order.update_shipping_fees! - end + create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1, + included_in_price: true) + .tap do |order| + order.create_tax_charge! + order.update_shipping_fees! + end end it "returns returns true" do From 4e54279b05fc31071e2fa32a3f769fd50d6ddfed Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 4 Sep 2023 19:03:05 +0100 Subject: [PATCH 13/14] Rearranges relevant and non-relevant test cases --- .../services/order_invoice_comparator_spec.rb | 150 +++++++++--------- 1 file changed, 77 insertions(+), 73 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index 4c05c814fa..af992e548d 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -17,94 +17,98 @@ describe OrderInvoiceComparator do } context "changes on the order object" do - it "returns false if the order didn't change" do - expect(subject).to be false - end + describe "detecting relevant attribute changes" do + it "returns true if a relevant attribute changes" do + Spree::Order.where(id: order.id).update_all(payment_total: order.payment_total + 10) + order.reload + expect(subject).to be true + end - it "returns true if a relevant attribute changes" do - Spree::Order.where(id: order.id).update_all(payment_total: order.payment_total + 10) - order.reload - expect(subject).to be true - end + it "returns true if a relevant attribute changes" do + Spree::Order.where(id: order.id).update_all(total: order.total + 10) + order.reload + expect(subject).to be true + end - it "returns true if a relevant attribute changes" do - Spree::Order.where(id: order.id).update_all(total: order.total + 10) - order.reload - expect(subject).to be true - end + it "returns true if a relevant attribute changes - order state: cancelled" do + order.cancel! + expect(subject).to be true + end - it "returns false if an attribute which should not change, changes" do - Spree::Order.where(id: order.id).update_all(number: 'R631504404') - order.reload - expect(subject).to be false - end + it "returns true if a relevant attribute changes - order state: resumed" do + order.cancel! + order.resume! + expect(subject).to be true + end - it "returns false if an attribute which should not change, changes" do - Spree::Order.where(id: order.id).update_all(currency: 'EUR') - order.reload - expect(subject).to be false - end + context "additional tax total changes" do + let(:order) do + create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1, + included_in_price: false) + .tap do |order| + order.create_tax_charge! + order.update_shipping_fees! + end + end - it "returns true if a relevant attribute changes - order state: cancelled" do - order.cancel! - expect(subject).to be true - end - - it "returns true if a relevant attribute changes - order state: resumed" do - order.cancel! - order.resume! - expect(subject).to be true - end - - it "returns false if a non-relevant attribute changes" do - order.update!(special_instructions: "A very special insctruction.") - expect(subject).to be false - end - - it "returns false if a non-relevant attribute changes" do - order.update!(note: "THIS IS A NEW NOTE") - expect(subject).to be false - end - - context "additional tax total changes" do - let(:order) do - create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1, - included_in_price: false) - .tap do |order| - order.create_tax_charge! - order.update_shipping_fees! + it "returns returns true" do + Spree::TaxRate.first.update!(amount: 0.15) + order.create_tax_charge! && order.save + expect(subject).to be true end end - it "returns returns true" do - Spree::TaxRate.first.update!(amount: 0.15) - order.create_tax_charge! && order.save - expect(subject).to be true - end - end + context "included tax total changes" do + let(:order) do + create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1, + included_in_price: true) + .tap do |order| + order.create_tax_charge! + order.update_shipping_fees! + end + end - context "included tax total changes" do - let(:order) do - create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1, - included_in_price: true) - .tap do |order| - order.create_tax_charge! - order.update_shipping_fees! + it "returns returns true" do + Spree::TaxRate.first.update!(amount: 0.15) + order.create_tax_charge! && order.save + expect(subject).to be true end end - it "returns returns true" do - Spree::TaxRate.first.update!(amount: 0.15) - order.create_tax_charge! && order.save - expect(subject).to be true + context "shipping method changes" do + let(:shipping_method) { create(:shipping_method) } + it "returns returns true" do + Spree::ShippingRate.first.update(shipping_method_id: shipping_method.id) + expect(subject).to be true + end end end - context "shipping method changes" do - let(:shipping_method) { create(:shipping_method) } - it "returns returns true" do - Spree::ShippingRate.first.update(shipping_method_id: shipping_method.id) - expect(subject).to be true + describe "ignoring non-relevant attribute changes" do + it "returns false if the order didn't change" do + expect(subject).to be false + end + + it "returns false if an attribute which should not change, changes" do + Spree::Order.where(id: order.id).update_all(number: 'R631504404') + order.reload + expect(subject).to be false + end + + it "returns false if an attribute which should not change, changes" do + Spree::Order.where(id: order.id).update_all(currency: 'EUR') + order.reload + expect(subject).to be false + end + + it "returns false if a non-relevant attribute changes" do + order.update!(special_instructions: "A very special insctruction.") + expect(subject).to be false + end + + it "returns false if a non-relevant attribute changes" do + order.update!(note: "THIS IS A NEW NOTE") + expect(subject).to be false end end end From 82ca1159316847dd02aee08a004b40b0178f822c Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 4 Sep 2023 19:35:28 +0100 Subject: [PATCH 14/14] Removes unnecessary && operator reloads instead of saving order again --- spec/services/order_invoice_comparator_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/services/order_invoice_comparator_spec.rb b/spec/services/order_invoice_comparator_spec.rb index af992e548d..6ee0fa7341 100644 --- a/spec/services/order_invoice_comparator_spec.rb +++ b/spec/services/order_invoice_comparator_spec.rb @@ -53,7 +53,8 @@ describe OrderInvoiceComparator do it "returns returns true" do Spree::TaxRate.first.update!(amount: 0.15) - order.create_tax_charge! && order.save + order.create_tax_charge! + order.reload expect(subject).to be true end end @@ -70,7 +71,8 @@ describe OrderInvoiceComparator do it "returns returns true" do Spree::TaxRate.first.update!(amount: 0.15) - order.create_tax_charge! && order.save + order.create_tax_charge! + order.reload expect(subject).to be true end end