From b2d78e7df6f1cb50913ece0fab5a7db5cb48d913 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Mon, 11 Apr 2016 08:55:05 +1000 Subject: [PATCH] Set allow_backorders explicitly for consistency in CI --- spec/models/spree/order_populator_spec.rb | 33 +++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/spec/models/spree/order_populator_spec.rb b/spec/models/spree/order_populator_spec.rb index 9f7cc47c51..4a50e59fa8 100644 --- a/spec/models/spree/order_populator_spec.rb +++ b/spec/models/spree/order_populator_spec.rb @@ -194,23 +194,28 @@ module Spree describe "quantities_to_add" do let(:v) { double(:variant, on_hand: 10) } - context "when max_quantity is not provided" do - it "returns full amount when available" do - op.quantities_to_add(v, 5, nil).should == [5, nil] + + context "when backorders are not allowed" do + before { Spree::Config.allow_backorders = false } + + context "when max_quantity is not provided" do + it "returns full amount when available" do + op.quantities_to_add(v, 5, nil).should == [5, nil] + end + + it "returns a limited amount when not entirely available" do + op.quantities_to_add(v, 15, nil).should == [10, nil] + end end - it "returns a limited amount when not entirely available" do - op.quantities_to_add(v, 15, nil).should == [10, nil] - end - end + context "when max_quantity is provided" do + it "returns full amount when available" do + op.quantities_to_add(v, 5, 6).should == [5, 6] + end - context "when max_quantity is provided" do - it "returns full amount when available" do - op.quantities_to_add(v, 5, 6).should == [5, 6] - end - - it "returns a limited amount when not entirely available" do - op.quantities_to_add(v, 15, 16).should == [10, 10] + it "returns a limited amount when not entirely available" do + op.quantities_to_add(v, 15, 16).should == [10, 10] + end end end