From ef09492883fea5d3d9511dd9238db6ecc66f8706 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 2 Jun 2023 15:14:20 +0100 Subject: [PATCH] Update adjustment spec to use orders past delivery state --- spec/models/spree/adjustment_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/models/spree/adjustment_spec.rb b/spec/models/spree/adjustment_spec.rb index 35a6ba5779..f1b30805b5 100644 --- a/spec/models/spree/adjustment_spec.rb +++ b/spec/models/spree/adjustment_spec.rb @@ -250,6 +250,7 @@ module Spree context "when the shipment has an inclusive tax rate" do it "calculates the shipment tax from the tax rate" do order.shipments = [shipment] + order.state = "payment" order.create_tax_charge! order.update_totals @@ -274,6 +275,7 @@ module Spree it "records the tax on the shipment's adjustments" do order.shipments = [shipment] + order.state = "payment" order.create_tax_charge! order.update_totals @@ -355,6 +357,7 @@ module Spree context "when enterprise fees have a fixed tax_category" do before do + order.update(state: "payment") order.recreate_all_fees! end @@ -440,6 +443,11 @@ module Spree calculator: ::Calculator::FlatRate.new(preferred_amount: 50.0)) } + before do + order.update(state: "payment") + order.create_tax_charge! + end + describe "when the tax rate includes the tax in the price" do it "records no tax on the enterprise fee adjustments" do # EnterpriseFee tax category is nil and inheritance only applies to per item fees @@ -471,6 +479,11 @@ module Spree calculator: ::Calculator::PerItem.new(preferred_amount: 50.0)) } + before do + order.update(state: "payment") + order.create_tax_charge! + end + describe "when the tax rate includes the tax in the price" do it "records the correct amount in a tax adjustment" do # Applying product tax rate of 0.2 to enterprise fee of $50 @@ -522,6 +535,8 @@ module Spree tax_category.tax_rates << tax_rate allow(order).to receive(:tax_zone) { zone } order.line_items << create(:line_item, variant: variant, quantity: 5) + order.update(state: "payment") + order.create_tax_charge! end context "with included taxes" do