Skip to content

Commit

Permalink
Merge pull request #4136 from aldesantis/remove-shipping-rate-taxer
Browse files Browse the repository at this point in the history
Remove unused `ShippingRateTaxer` service object
  • Loading branch information
aldesantis authored Jul 30, 2021
2 parents 3cc23f5 + 73e7470 commit 052dc22
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 88 deletions.
2 changes: 1 addition & 1 deletion core/app/models/spree/shipping_rate_tax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Spree
# @attr [Spree::ShippingRate] shipping_rate The shipping rate to be taxed
# @attr [Spree::TaxRate] tax_rate The tax rate used to calculate the tax amount
# @since 1.3.0
# @see Spree::Tax::ShippingRateTaxer
# @see Spree::Stock::Estimator
class ShippingRateTax < Spree::Base
belongs_to :shipping_rate, class_name: "Spree::ShippingRate", optional: true
belongs_to :tax_rate, class_name: "Spree::TaxRate", optional: true
Expand Down
24 changes: 0 additions & 24 deletions core/app/models/spree/tax/shipping_rate_taxer.rb

This file was deleted.

2 changes: 1 addition & 1 deletion core/app/models/spree/tax_calculator/shipping_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module TaxCalculator
# looking to provide their own calculator should adhere to the API of this
# class.
#
# @see Spree::Tax::ShippingRateTaxer
# @see Spree::Stock::Estimator
class ShippingRate
include Spree::Tax::TaxHelpers

Expand Down
20 changes: 17 additions & 3 deletions core/spec/models/spree/shipping_rate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
let(:order_address) { address }

before do
Spree::Tax::ShippingRateTaxer.new.tax(shipping_rate)
shipping_rate.taxes.build(
amount: 0.91,
tax_rate: tax_rate,
)
end

it "shows correct tax amount" do
Expand Down Expand Up @@ -68,7 +71,10 @@
let(:order_address) { address }

before do
Spree::Tax::ShippingRateTaxer.new.tax(shipping_rate)
shipping_rate.taxes.build(
amount: 1.0,
tax_rate: tax_rate,
)
end

it "shows correct tax amount" do
Expand Down Expand Up @@ -107,7 +113,15 @@
let(:order_address) { address }

before do
Spree::Tax::ShippingRateTaxer.new.tax(shipping_rate)
shipping_rate.taxes.build(
amount: 1.0,
tax_rate: tax_rate,
)

shipping_rate.taxes.build(
amount: 0.5,
tax_rate: other_tax_rate,
)
end

it "shows correct tax amount" do
Expand Down
59 changes: 0 additions & 59 deletions core/spec/models/spree/tax/shipping_rate_taxer_spec.rb

This file was deleted.

0 comments on commit 052dc22

Please sign in to comment.