From 5ad960c7588e8422dc1b3cc4577ec578bc30d54e Mon Sep 17 00:00:00 2001 From: Noah Silvera Date: Wed, 16 Jun 2021 14:53:16 -0700 Subject: Specify all spree namespaces in lib as root namespaces An upcoming commit will add a decorator that creates the SuperGood::SolidusTaxjar::Spree namespace, which will change which module all existing Spree instances in the lib folder reference. We should force them to look for the root Spree namespace so tests do not break. --- lib/super_good/solidus_taxjar/addresses.rb | 6 +++--- lib/super_good/solidus_taxjar/calculator_helper.rb | 2 +- lib/super_good/solidus_taxjar/tax_calculator.rb | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/super_good/solidus_taxjar/addresses.rb b/lib/super_good/solidus_taxjar/addresses.rb index 7fdf852..409d0d3 100644 --- a/lib/super_good/solidus_taxjar/addresses.rb +++ b/lib/super_good/solidus_taxjar/addresses.rb @@ -20,7 +20,7 @@ module SuperGood return if taxjar_address.nil? - Spree::Address.immutable_merge(spree_address, { + ::Spree::Address.immutable_merge(spree_address, { country: us, # TaxJar only supports the US currently. state: state(taxjar_address.state), zipcode: taxjar_address.zip, @@ -31,7 +31,7 @@ module SuperGood def possibilities(spree_address) taxjar_addresses(spree_address).map { |taxjar_address| - Spree::Address.immutable_merge(spree_address, { + ::Spree::Address.immutable_merge(spree_address, { country: us, # TaxJar only supports the US currently. state: state(taxjar_address.state), zipcode: taxjar_address.zip, @@ -52,7 +52,7 @@ module SuperGood end def us - Spree::Country.find_by iso: "US" + ::Spree::Country.find_by iso: "US" end def state(abbr) diff --git a/lib/super_good/solidus_taxjar/calculator_helper.rb b/lib/super_good/solidus_taxjar/calculator_helper.rb index edf0754..9145658 100644 --- a/lib/super_good/solidus_taxjar/calculator_helper.rb +++ b/lib/super_good/solidus_taxjar/calculator_helper.rb @@ -4,7 +4,7 @@ module SuperGood extend ActiveSupport::Concern def incomplete_address?(address) - return true if address.is_a?(Spree::Tax::TaxLocation) + return true if address.is_a?(::Spree::Tax::TaxLocation) [ address.address1, diff --git a/lib/super_good/solidus_taxjar/tax_calculator.rb b/lib/super_good/solidus_taxjar/tax_calculator.rb index 74e6f9b..1c9a4da 100644 --- a/lib/super_good/solidus_taxjar/tax_calculator.rb +++ b/lib/super_good/solidus_taxjar/tax_calculator.rb @@ -17,7 +17,7 @@ module SuperGood cache do next no_tax unless taxjar_breakdown - Spree::Tax::OrderTax.new( + ::Spree::Tax::OrderTax.new( order_id: order.id, line_item_taxes: line_item_taxes, shipment_taxes: shipment_taxes @@ -41,7 +41,7 @@ module SuperGood # orders aren't going to have a huge number of line items. spree_line_item = order.line_items.find { |li| li.id == spree_line_item_id } - Spree::Tax::ItemTax.new( + ::Spree::Tax::ItemTax.new( item_id: spree_line_item_id, label: line_item_tax_label(taxjar_line_item, spree_line_item), tax_rate: tax_rate, @@ -102,7 +102,7 @@ module SuperGood end def no_tax - Spree::Tax::OrderTax.new( + ::Spree::Tax::OrderTax.new( order_id: order.id, line_item_taxes: [], shipment_taxes: [] @@ -110,7 +110,7 @@ module SuperGood end def tax_rate - Spree::TaxRate.find_by(name: "Sales Tax") + ::Spree::TaxRate.find_by(name: "Sales Tax") end def cache_key -- cgit v1.2.3