diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/super_good/solidus_taxjar/tax_calculator_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/super_good/solidus_taxjar/tax_calculator_spec.rb b/spec/super_good/solidus_taxjar/tax_calculator_spec.rb index 87d30c4..b537bfc 100644 --- a/spec/super_good/solidus_taxjar/tax_calculator_spec.rb +++ b/spec/super_good/solidus_taxjar/tax_calculator_spec.rb @@ -15,6 +15,7 @@ RSpec.describe ::SuperGood::SolidusTaxJar::TaxCalculator do id: 10, store: store, ship_address: address, + line_items: line_items, shipments: [ boring_shipment, shipment_with_adjustment, @@ -23,6 +24,8 @@ RSpec.describe ::SuperGood::SolidusTaxJar::TaxCalculator do ) end + let(:line_items) { [::Spree::LineItem.new] } + let(:boring_shipment) do ::Spree::Shipment.new(id: 1, cost: 7) end @@ -71,6 +74,23 @@ RSpec.describe ::SuperGood::SolidusTaxJar::TaxCalculator do end end + context "when the order has no line items" do + let(:address) do + ::Spree::Address.new( + first_name: "Ronnie James", + country: ::Spree::Country.new(iso: "US") + ) + end + + let(:line_items) { [] } + + it "returns no taxes" do + expect(subject.order_id).to eq order.id + expect(subject.shipment_taxes).to be_empty + expect(subject.line_item_taxes).to be_empty + end + end + context "when the API encounters an error" do let(:address) do ::Spree::Address.new( |