mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Don't put master in order cycle - we don't do that no more
This commit is contained in:
@@ -11,7 +11,7 @@ feature "full-page cart", js: true do
|
||||
let!(:zone) { create(:zone_with_member) }
|
||||
let(:distributor) { create(:distributor_enterprise, with_payment_and_shipping: true, charges_sales_tax: true) }
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let!(:order_cycle) { create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.master]) }
|
||||
let!(:order_cycle) { create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.variants.first]) }
|
||||
let(:enterprise_fee) { create(:enterprise_fee, amount: 11.00, tax_category: product.tax_category) }
|
||||
let(:product) { create(:taxed_product, supplier: supplier, zone: zone, price: 110.00, tax_rate_amount: 0.1) }
|
||||
let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) }
|
||||
|
||||
@@ -11,9 +11,10 @@ feature "As a consumer I want to check out my cart", js: true do
|
||||
let!(:zone) { create(:zone_with_member) }
|
||||
let(:distributor) { create(:distributor_enterprise, charges_sales_tax: true) }
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let!(:order_cycle) { create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [product.master]) }
|
||||
let!(:order_cycle) { create(:simple_order_cycle, suppliers: [supplier], distributors: [distributor], coordinator: create(:distributor_enterprise), variants: [variant]) }
|
||||
let(:enterprise_fee) { create(:enterprise_fee, amount: 1.23, tax_category: product.tax_category) }
|
||||
let(:product) { create(:taxed_product, supplier: supplier, price: 10, zone: zone, tax_rate_amount: 0.1) }
|
||||
let(:variant) { product.variants.first }
|
||||
let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) }
|
||||
|
||||
before do
|
||||
|
||||
@@ -182,7 +182,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
describe "with variants on the product" do
|
||||
let(:variant) { create(:variant, product: product, on_hand: 10 ) }
|
||||
before do
|
||||
add_product_and_variant_to_order_cycle(exchange, product, variant)
|
||||
add_variant_to_order_cycle(exchange, variant)
|
||||
set_order_cycle(order, oc1)
|
||||
visit shop_path
|
||||
end
|
||||
@@ -217,7 +217,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
let(:variant) { create(:variant, product: product) }
|
||||
|
||||
before do
|
||||
add_product_and_variant_to_order_cycle(exchange, product, variant)
|
||||
add_variant_to_order_cycle(exchange, variant)
|
||||
set_order_cycle(order, oc1)
|
||||
visit shop_path
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ module ShopWorkflow
|
||||
|
||||
def add_product_to_cart
|
||||
populator = Spree::OrderPopulator.new(order, order.currency)
|
||||
populator.populate(variants: {product.master.id => 1})
|
||||
populator.populate(variants: {product.variants.first.id => 1})
|
||||
|
||||
# Recalculate fee totals
|
||||
order.update_distribution_charge!
|
||||
@@ -28,15 +28,10 @@ module ShopWorkflow
|
||||
find("dd a", text: name).trigger "click"
|
||||
end
|
||||
|
||||
def add_product_to_order_cycle(exchange, product)
|
||||
exchange.variants << product.master
|
||||
def add_variant_to_order_cycle(exchange, variant)
|
||||
exchange.variants << variant
|
||||
end
|
||||
|
||||
def add_product_and_variant_to_order_cycle(exchange, product, variant)
|
||||
exchange.variants << product.master
|
||||
exchange.variants << variant
|
||||
end
|
||||
|
||||
def set_order_cycle(order, order_cycle)
|
||||
order.update_attribute(:order_cycle, order_cycle)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user