mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Fix simple rubocop issues
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Stock
|
||||
class Packer
|
||||
attr_reader :stock_location, :order, :splitters, :package_factory
|
||||
|
||||
def initialize(stock_location, order, splitters=[Splitter::Base])
|
||||
def initialize(stock_location, order, splitters = [Splitter::Base])
|
||||
@stock_location = stock_location
|
||||
@order = order
|
||||
@splitters = splitters
|
||||
@@ -25,8 +27,8 @@ module Spree
|
||||
next unless stock_location.stock_item(line_item.variant)
|
||||
|
||||
on_hand, backordered = stock_location.fill_status(line_item.variant, line_item.quantity)
|
||||
package.add line_item.variant, on_hand, :on_hand if on_hand > 0
|
||||
package.add line_item.variant, backordered, :backordered if backordered > 0
|
||||
package.add line_item.variant, on_hand, :on_hand if on_hand.positive?
|
||||
package.add line_item.variant, backordered, :backordered if backordered.positive?
|
||||
else
|
||||
package.add line_item.variant, line_item.quantity, :on_hand
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
module Spree
|
||||
@@ -33,7 +35,7 @@ module Spree
|
||||
end
|
||||
|
||||
it 'variants are added as backordered without enough on_hand' do
|
||||
stock_location.should_receive(:fill_status).exactly(5).times.and_return([2,3])
|
||||
stock_location.should_receive(:fill_status).exactly(5).times.and_return([2, 3])
|
||||
|
||||
package = subject.default_package
|
||||
package.on_hand.size.should eq 5
|
||||
|
||||
Reference in New Issue
Block a user