Replace obsolete count_on_hand call for variant

The variant factory supports only `on_hand` now.
This commit is contained in:
Maikel Linke
2018-08-30 10:14:35 +10:00
parent e9c1868759
commit cebcdea40c
6 changed files with 10 additions and 10 deletions

View File

@@ -82,8 +82,8 @@ describe Spree::OrdersController, type: :controller do
describe "generating stock levels" do
let!(:order) { create(:order) }
let!(:li) { create(:line_item, order: order, variant: v, quantity: 2, max_quantity: 3) }
let!(:v) { create(:variant, count_on_hand: 4) }
let!(:v2) { create(:variant, count_on_hand: 2) }
let!(:v) { create(:variant, on_hand: 4) }
let!(:v2) { create(:variant, on_hand: 2) }
before do
order.reload
@@ -107,7 +107,7 @@ describe Spree::OrdersController, type: :controller do
end
describe "encoding Infinity" do
let!(:v) { create(:variant, on_demand: true, count_on_hand: 0) }
let!(:v) { create(:variant, on_demand: true, on_hand: 0) }
it "encodes Infinity as a large, finite integer" do
controller.stock_levels(order, [v.id]).should ==

View File

@@ -64,9 +64,9 @@ describe SubscriptionPlacementJob do
let(:shop) { order_cycle.coordinator }
let(:order) { create(:order, order_cycle: order_cycle, distributor: shop) }
let(:ex) { create(:exchange, :order_cycle => order_cycle, :sender => shop, :receiver => shop, :incoming => false) }
let(:variant1) { create(:variant, count_on_hand: 5) }
let(:variant2) { create(:variant, count_on_hand: 5) }
let(:variant3) { create(:variant, count_on_hand: 5) }
let(:variant1) { create(:variant, on_hand: 5) }
let(:variant2) { create(:variant, on_hand: 5) }
let(:variant3) { create(:variant, on_hand: 5) }
let!(:line_item1) { create(:line_item, order: order, variant: variant1, quantity: 3) }
let!(:line_item2) { create(:line_item, order: order, variant: variant2, quantity: 3) }
let!(:line_item3) { create(:line_item, order: order, variant: variant3, quantity: 3) }

View File

@@ -36,7 +36,7 @@ module OpenFoodNetwork
describe "lists" do
let(:v2) { create(:variant) }
let(:v3) { create(:variant) }
let(:v4) { create(:variant, count_on_hand: 0, on_demand: true) }
let(:v4) { create(:variant, on_hand: 0, on_demand: true) }
let(:hub_address) { create(:address, :address1 => "distributor address", :city => 'The Shire', :zipcode => "1234") }
let(:hub) { create(:distributor_enterprise, :address => hub_address) }
let(:v2o) { create(:variant_override, hub: hub, variant: v2) }

View File

@@ -3,7 +3,7 @@ require 'open_food_network/scope_variant_to_hub'
module OpenFoodNetwork
describe ScopeVariantToHub do
let(:hub) { create(:distributor_enterprise) }
let(:v) { create(:variant, price: 11.11, count_on_hand: 1, on_demand: true, sku: "VARIANTSKU") }
let(:v) { create(:variant, price: 11.11, on_hand: 1, on_demand: true, sku: "VARIANTSKU") }
let(:vo) { create(:variant_override, hub: hub, variant: v, price: 22.22, count_on_hand: 2, on_demand: false, sku: "VOSKU") }
let(:vo_price_only) { create(:variant_override, hub: hub, variant: v, price: 22.22, count_on_hand: nil) }
let(:scoper) { ScopeVariantToHub.new(hub) }

View File

@@ -59,7 +59,7 @@ describe VariantOverride do
describe "looking up count on hand" do
it "returns the numeric stock level when present" do
VariantOverride.create!(variant: variant, hub: hub, count_on_hand: 12)
VariantOverride.create!(variant: variant, hub: hub, on_hand: 12)
VariantOverride.count_on_hand_for(hub, variant).should == 12
end

View File

@@ -7,7 +7,7 @@ describe SubscriptionForm do
let!(:product3) { create(:product, supplier: shop) }
let!(:variant1) { create(:variant, product: product1, unit_value: '100', price: 12.00, option_values: []) }
let!(:variant2) { create(:variant, product: product2, unit_value: '1000', price: 6.00, option_values: []) }
let!(:variant3) { create(:variant, product: product2, unit_value: '1000', price: 2.50, option_values: [], count_on_hand: 1) }
let!(:variant3) { create(:variant, product: product2, unit_value: '1000', price: 2.50, option_values: [], on_hand: 1) }
let!(:enterprise_fee) { create(:enterprise_fee, amount: 1.75) }
let!(:order_cycle1) { create(:simple_order_cycle, coordinator: shop, orders_open_at: 9.days.ago, orders_close_at: 2.days.ago) }
let!(:order_cycle2) { create(:simple_order_cycle, coordinator: shop, orders_open_at: 2.days.ago, orders_close_at: 5.days.from_now) }