Alter on_hand counts for products to fix broken specs

This commit is contained in:
Rob H
2014-03-06 13:14:06 +11:00
parent 200e3fef77
commit 43a4a3dd5a
3 changed files with 4 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ module OpenFoodNetwork
product1.distributors << distributor
product1.save
put :add_variant, { cart_id: cart, variant_id: product1.master.id, quantity: 4, distributor_id: distributor, order_cycle_id: nil, max_quantity: nil }
put :add_variant, { cart_id: cart, variant_id: product1.master.id, quantity: (product1.master.on_hand-1), distributor_id: distributor, order_cycle_id: nil, max_quantity: nil }
cart.orders.size.should == 1
cart.orders.first.line_items.size.should == 1

View File

@@ -47,7 +47,7 @@ describe Spree::OrdersController do
describe "when I pass params that includes a line item no longer in our cart" do
it "should silently ignore the missing line item" do
order = subject.current_order(true)
li = order.add_variant(create(:simple_product).master)
li = order.add_variant(create(:simple_product, on_hand: 110).master)
spree_get :update, order: { line_items_attributes: {
"0" => {quantity: "0", id: "9999"},
"1" => {quantity: "99", id: li.id}

View File

@@ -236,7 +236,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
describe "group buy products" do
let(:oc) { create(:simple_order_cycle, distributors: [distributor]) }
let(:product) { create(:simple_product, group_buy: true) }
let(:product) { create(:simple_product, group_buy: true, on_hand: 15) }
describe "without variants" do
before do
@@ -259,7 +259,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
end
describe "with variants on the product" do
let(:variant) { create(:variant, product: product) }
let(:variant) { create(:variant, product: product, on_hand: 10 ) }
before do
build_and_select_order_cycle_with_variants
find(".expand").trigger "click"