Sha256: 893812ed615a23cbd156e85db3a2fd22dec7dec08ae7d30270c10344de2b117b

Contents?: true

Size: 860 Bytes

Versions: 22

Compression:

Stored size: 860 Bytes

Contents

require 'spec_helper'

module Spree
  module Calculator::Shipping
    describe PriceSack do
      let(:variant) { build(:variant, price: 2) }
      subject(:calculator) do
        calculator = PriceSack.new
        calculator.preferred_minimal_amount = 5
        calculator.preferred_normal_amount = 10
        calculator.preferred_discount_amount = 1
        calculator
      end

      let(:normal_package) do
        build(:stock_package, variants_contents: { variant => 2 })
      end

      let(:discount_package) do
        build(:stock_package, variants_contents: { variant => 4 })
      end

      it 'computes the correct amount' do
        expect(calculator.compute(normal_package)).to eq(calculator.preferred_normal_amount)
        expect(calculator.compute(discount_package)).to eq(calculator.preferred_discount_amount)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
spree_core-3.3.0.rc1 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.5 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.2.1 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.2.0 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.4 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.2.0.rc3 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.2.0.rc2 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.2.0.rc1 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.3 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.2 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.0.10 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.1 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.0 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.0.rc4 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.0.9 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.0.rc3 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.0.rc2 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.1.0.rc1 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.0.8 spec/models/spree/calculator/shipping/price_sack_spec.rb
spree_core-3.0.7 spec/models/spree/calculator/shipping/price_sack_spec.rb