Sha256: d1607f5eefbdfc7a7d166f35ac9f7a73a58659c9b1e74e22aee2d72fa2cc7439
Contents?: true
Size: 956 Bytes
Versions: 11
Compression:
Stored size: 956 Bytes
Contents
require 'rails_helper' module Spree module Stock module Splitter RSpec.describe Weight, type: :model do let(:stock_location) { mock_model(Spree::StockLocation) } let(:variant) { build(:base_variant, weight: 100) } subject { Weight.new(stock_location) } it 'splits and keeps splitting until all packages are underweight' do package = Package.new(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(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
11 entries across 11 versions & 1 rubygems