Don't put master in order cycle - we don't do that no more

This commit is contained in:
Rohan Mitchell
2016-03-02 14:56:25 +11:00
parent f986c5898e
commit 9e321a63c0
4 changed files with 8 additions and 12 deletions

View File

@@ -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) }

View File

@@ -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

View File

@@ -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

View File

@@ -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