diff --git a/app/models/spree/stock_item.rb b/app/models/spree/stock_item.rb index d1c9faa983..29ec2401fa 100644 --- a/app/models/spree/stock_item.rb +++ b/app/models/spree/stock_item.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Spree class StockItem < ActiveRecord::Base belongs_to :stock_location, class_name: 'Spree::StockLocation' @@ -39,15 +40,17 @@ module Spree end private - def count_on_hand=(value) - write_attribute(:count_on_hand, value) - end - def process_backorders - backordered_inventory_units.each do |unit| - return unless in_stock? - unit.fill_backorder - end + def count_on_hand=(value) + write_attribute(:count_on_hand, value) + end + + def process_backorders + backordered_inventory_units.each do |unit| + return unless in_stock? + + unit.fill_backorder end + end end end diff --git a/spec/models/spree/stock_item_spec.rb b/spec/models/spree/stock_item_spec.rb index f58a0bd09c..c59416371d 100644 --- a/spec/models/spree/stock_item_spec.rb +++ b/spec/models/spree/stock_item_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' RSpec.describe Spree::StockItem do