Sha256: a182a3ac9268287a9c78c0ce80c4644a4c55aaa942f0ac2fecde21ec7372eace

Contents?: true

Size: 916 Bytes

Versions: 48

Compression:

Stored size: 916 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

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

        let(:stock_location) { mock_model(Spree::StockLocation) }

        subject { Backordered.new(stock_location) }

        it 'splits packages by status' do
          package = Package.new(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

48 entries across 48 versions & 2 rubygems

Version Path
solidus_core-2.10.5 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.10.3 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.10.2 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.6 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.8.6 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.10.1 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.5 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.10.0 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.4 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.6.6 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.7.4 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.8.5 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.3 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.2 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.10.0.beta1 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.7.3 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.6.5 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.1 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.0 spec/models/spree/stock/splitter/backordered_spec.rb
solidus_core-2.9.0.rc.1 spec/models/spree/stock/splitter/backordered_spec.rb