diff options
author | Jared Norman <jared@super.gd> | 2019-01-20 13:29:46 -0800 |
---|---|---|
committer | Jared Norman <jared@super.gd> | 2019-01-20 13:29:46 -0800 |
commit | 8912e81c695ec1aafe3fdb03203d31fdee71e9a6 (patch) | |
tree | 59858092475f04efe7e537cc53cfced67ca863f8 /spec | |
parent | 6488fd15856d4db6204f8726d6b5f5c8d1abf14b (diff) |
Improve tax handling
This is partially a refactor, and also handles the unlikely scenario
where there is a shipping tax, but no breakdown.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/super_good/solidus_taxjar/tax_calculator_spec.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/super_good/solidus_taxjar/tax_calculator_spec.rb b/spec/super_good/solidus_taxjar/tax_calculator_spec.rb index 19841a8..b97f53b 100644 --- a/spec/super_good/solidus_taxjar/tax_calculator_spec.rb +++ b/spec/super_good/solidus_taxjar/tax_calculator_spec.rb @@ -79,12 +79,12 @@ RSpec.describe ::SuperGood::SolidusTaxJar::TaxCalculator do instance_double( ::Taxjar::Tax, breakdown: breakdown, - shipping: 10.0 + shipping: shipping_tax ) ) end - context "and there is a breakdown" do + context "and there is tax" do let!(:tax_rate) do ::Spree::TaxRate.create!( name: "Sales Tax", @@ -93,6 +93,8 @@ RSpec.describe ::SuperGood::SolidusTaxJar::TaxCalculator do ) end + let(:shipping_tax) { 10 } + let(:breakdown) do instance_double ::Taxjar::Breakdown, line_items: [taxjar_line_item] end @@ -141,6 +143,7 @@ RSpec.describe ::SuperGood::SolidusTaxJar::TaxCalculator do context "and there is not a breakdown" do let(:breakdown) { nil } + let(:shipping_tax) { 0 } it "returns no taxes" do expect(subject.order_id).to eq order.id |