Sha256: 9831546dc16fafa2d5545156028e76e0f575d4600099106f04f5f2d99eadc86f
Contents?: true
Size: 944 Bytes
Versions: 16
Compression:
Stored size: 944 Bytes
Contents
require 'spec_helper' module Spree module Stock module Splitter describe Weight, :type => :model do let(:packer) { build(:stock_packer) } let(:variant) { build(:base_variant, :weight => 100) } subject { Weight.new(packer) } it 'splits and keeps splitting until all packages are underweight' do package = Package.new(packer.stock_location) 4.times { package.add build(:inventory_unit, variant: variant) } packages = subject.split([package]) expect(packages.size).to eq 4 end it 'handles packages that can not be reduced' do package = Package.new(packer.stock_location) allow(variant).to receive_messages(:weight => 200) 2.times { package.add build(:inventory_unit, variant: variant) } packages = subject.split([package]) expect(packages.size).to eq 2 end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems