summaryrefslogtreecommitdiff
path: root/spec/super_good
diff options
context:
space:
mode:
authorJared Norman <jared@super.gd>2019-04-11 14:59:24 +1200
committerJared Norman <jared@super.gd>2019-04-11 14:59:24 +1200
commit0c7fb7e0e6d4c8a16c0454fedb60f1ae5d9690d3 (patch)
tree66498f2adbf66565def092c9dc9c041e38442500 /spec/super_good
parentfbd8c7c044803843deae20045dd7972f1e6c34ac (diff)
Avoid sending negative order totals
If an order is adjusted to zero, we don't want to subtract the tax from it... because that don't make no sense. A better solution that properly factors in order level adjustments will be coming eventually, this is just a hack to process some orders immediately.
Diffstat (limited to 'spec/super_good')
-rw-r--r--spec/super_good/solidus_taxjar/api_params_spec.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/super_good/solidus_taxjar/api_params_spec.rb b/spec/super_good/solidus_taxjar/api_params_spec.rb
index 9c8696f..2e9e289 100644
--- a/spec/super_good/solidus_taxjar/api_params_spec.rb
+++ b/spec/super_good/solidus_taxjar/api_params_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe SuperGood::SolidusTaxJar::APIParams do
let(:order) do
Spree::Order.create!(
number: "R111222333",
- total: BigDecimal("123.45"),
+ total: order_total,
shipment_total: BigDecimal("3.01"),
additional_tax_total: BigDecimal("9.87"),
item_total: BigDecimal("28.00"),
@@ -15,6 +15,7 @@ RSpec.describe SuperGood::SolidusTaxJar::APIParams do
order.update! completed_at: DateTime.new(2018, 3, 6, 12, 10, 33)
end
end
+ let(:order_total) { BigDecimal("123.45") }
let(:store) do
Spree::Store.create!(
@@ -211,6 +212,14 @@ RSpec.describe SuperGood::SolidusTaxJar::APIParams do
})
end
+ context "when the order is adjusted to 0" do
+ let(:order_total) { BigDecimal("0") }
+
+ it "sends the order total as zero" do
+ expect(subject[:amount]).to be_zero
+ end
+ end
+
context "when the line item has 0 quantity" do
let(:line_item) do
Spree::LineItem.new(