Sha256: e33633d934e1f17283772488b290d848e3c7125638adaf61e3d9d918d1c157dd

Contents?: true

Size: 860 Bytes

Versions: 32

Compression:

Stored size: 860 Bytes

Contents

require 'spec_helper'

module Spree
  module Stock
    module Splitter
      describe Backordered, :type => :model do
        let(:variant) { build(:variant) }

        let(:packer) { build(:stock_packer) }

        subject { Backordered.new(packer) }

        it 'splits packages by status' do
          package = Package.new(packer.stock_location)
          4.times { package.add build(:inventory_unit, variant: variant) }
          5.times { package.add build(:inventory_unit, variant: variant), :backordered }

          packages = subject.split([package])
          expect(packages.count).to eq 2
          expect(packages.first.quantity).to eq 4
          expect(packages.first.on_hand.count).to eq 4
          expect(packages.first.backordered.count).to eq 0

          expect(packages[1].contents.count).to eq 5
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

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