Sha256: f1506aa7c78cb4782938dabd587e0fce2a4e31b758a0a030dc1a58b6bac82c13

Contents?: true

Size: 685 Bytes

Versions: 32

Compression:

Stored size: 685 Bytes

Contents

require 'spec_helper'

module Spree
  module Calculator::Shipping
    describe FlatPercentItemTotal, :type => :model do
      let(:variant1) { build(:variant, :price => 10.11) }
      let(:variant2) { build(:variant, :price => 20.2222) }

      let(:line_item1) { build(:line_item, variant: variant1) }
      let(:line_item2) { build(:line_item, variant: variant2) }

      let(:package) do
        build(:stock_package, variants_contents: { variant1 => 2, variant2 => 1 })
      end

      subject { FlatPercentItemTotal.new(:preferred_flat_percent => 10) }

      it "should round result correctly" do
        expect(subject.compute(package)).to eq(4.04)
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
solidus_core-1.2.3 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
solidus_core-1.1.4 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
solidus_core-1.0.7 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.5 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.4 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.3 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.2 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.0.10 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.1 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.0 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.0.rc4 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.0.9 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.0.rc3 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.0.rc2 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.1.0.rc1 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
solidus_core-1.0.6 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.0.8 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
solidus_core-1.2.2 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
spree_core-3.0.7 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb
solidus_core-1.2.1 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb