Sha256: f51afa5cec4b5356977c7fc394b1520b100c4a68ef0baa1767a8e4350d33e4bd

Contents?: true

Size: 668 Bytes

Versions: 5

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'
require 'shared_examples/calculator_shared_examples'

module Spree
  module Calculator::Shipping
    RSpec.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 { described_class.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

5 entries across 5 versions & 1 rubygems

Version Path
solidus_core-2.10.5 spec/models/spree/calculator/shipping/per_item_spec.rb
solidus_core-2.10.3 spec/models/spree/calculator/shipping/per_item_spec.rb
solidus_core-2.10.2 spec/models/spree/calculator/shipping/per_item_spec.rb
solidus_core-2.10.1 spec/models/spree/calculator/shipping/per_item_spec.rb
solidus_core-2.10.0 spec/models/spree/calculator/shipping/per_item_spec.rb