mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Disable allow_backorders by default in test environment
This commit is contained in:
committed by
Rob Harrington
parent
cd6d7c76f6
commit
01647c3df9
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user