diff options
author | Jared Norman <jared@super.gd> | 2019-01-24 17:57:06 -0800 |
---|---|---|
committer | Jared Norman <jared@super.gd> | 2019-01-28 10:35:05 -0800 |
commit | c9633203f85fc690ec0213aca4da7198dcd43f16 (patch) | |
tree | cb974be0ec61c1da8969bdb443e1cc5c35ecbd55 /spec | |
parent | 0eb33f99cd2054230c5a3ba80ab8d3633f16c04b (diff) |
Introduce DiscountCalculator
This extracts the functionality of calculating the discount for a line
item in the interest of making this behaviour configurable for stores
that would like to factor in order level adjustments in some way.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/super_good/solidus_taxjar/discount_calculator_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/super_good/solidus_taxjar/discount_calculator_spec.rb b/spec/super_good/solidus_taxjar/discount_calculator_spec.rb new file mode 100644 index 0000000..b89b4dc --- /dev/null +++ b/spec/super_good/solidus_taxjar/discount_calculator_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +RSpec.describe SuperGood::SolidusTaxJar::DiscountCalculator do + describe "#discount" do + subject { calculator.discount } + + let(:calculator) { described_class.new line_item } + + let(:line_item) { ::Spree::LineItem.new(promo_total: 12.34) } + + it { is_expected.to eq(-12.34) } + end +end |