Disable allow_backorders by default in test environment

This commit is contained in:
Matt-Yorkley
2017-10-09 17:24:29 +01:00
committed by Rob Harrington
parent cd6d7c76f6
commit 01647c3df9
7 changed files with 3 additions and 17 deletions

View File

@@ -103,7 +103,6 @@ describe EnterprisesController do
order.set_distribution! current_distributor, order_cycle
order.line_items << line_item
Spree::Config.set allow_backorders: false
variant.on_hand = 0
variant.save!
end

View File

@@ -51,7 +51,6 @@ describe Spree::OrdersController do
let(:line_item) { order.line_items.last }
before do
Spree::Config.allow_backorders = false
order.set_distribution! d, oc
order.add_variant variant, 5
variant.update_attributes! on_hand: 3

View File

@@ -109,7 +109,6 @@ feature %q{
let!(:li1) { create(:line_item, order: o1, :quantity => 5 ) }
before :each do
Spree::Config.set(allow_backorders: false)
li1.variant.update_attributes(on_hand: 1, on_demand: false)
visit '/admin/orders/bulk_management'
end

View File

@@ -20,13 +20,6 @@ feature "full-page cart", js: true do
set_order order
end
around do |example|
allow_backorders = Spree::Config.allow_backorders
Spree::Config.allow_backorders = false
example.run
Spree::Config.allow_backorders = allow_backorders
end
describe "product description" do
it "does not link to the product page" do
add_product_to_cart order, product_fee, quantity: 2

View File

@@ -47,7 +47,6 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do
describe "when I have an out of stock product in my cart" do
before do
Spree::Config.set allow_backorders: false
variant.on_hand = 0
variant.save!
end
@@ -392,7 +391,6 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do
end
it "takes us to the cart page with an error when a product becomes out of stock just before we purchase", js: true do
Spree::Config.set allow_backorders: false
variant.on_hand = 0
variant.save!

View File

@@ -196,8 +196,6 @@ module Spree
let(:v) { double(:variant, on_hand: 10) }
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]
@@ -220,10 +218,8 @@ module Spree
end
context "when backorders are allowed" do
around do |example|
before do
Spree::Config.allow_backorders = true
example.run
Spree::Config.allow_backorders = false
end
it "does not limit quantity" do

View File

@@ -100,11 +100,13 @@ RSpec.configure do |config|
# Ensure we start with consistent config settings
config.before(:each) do
reset_spree_preferences do |spree_config|
# These are all settings that differ from Spree's defaults
spree_config.default_country_id = default_country_id
spree_config.checkout_zone = checkout_zone
spree_config.currency = currency
spree_config.shipping_instructions = true
spree_config.auto_capture = true
spree_config.allow_backorders = false
end
Spree::Api::Config[:requires_authentication] = true