Sha256: 73143160ba2e1cf49e69e037ee416e38f317bc6d0728471c651031514607a71b
Contents?: true
Size: 622 Bytes
Versions: 15
Compression:
Stored size: 622 Bytes
Contents
require 'spec_helper' require 'shared_examples/calculator_shared_examples' module Spree module Calculator::Shipping describe PerItem, type: :model do let(:variant1) { build(:variant) } let(:variant2) { build(:variant) } it_behaves_like 'a calculator with a description' let(:package) do build(:stock_package, variants_contents: { variant1 => 5, variant2 => 3 }) end subject { PerItem.new(preferred_amount: 10) } it "correctly calculates per item shipping" do expect(subject.compute(package).to_f).to eq(80) # 5 x 10 + 3 x 10 end end end end
Version data entries
15 entries across 15 versions & 1 rubygems