Sha256: ccad349883506c8816de399fcfde5750c711e5c024fd6408e9851670f633d25e

Contents?: true

Size: 783 Bytes

Versions: 1

Compression:

Stored size: 783 Bytes

Contents

require 'spec_helper'
require 'shared_examples/calculator_shared_examples'

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

      it_behaves_like 'a calculator with a description'

      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

1 entries across 1 versions & 1 rubygems

Version Path
solidus_core-2.1.0.beta1 spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb