From 7a2bc384d57d09bb44db70f0ce6571f929074275 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 12 Mar 2019 11:25:23 +0000 Subject: [PATCH] Re-add spec removed in product distributions removal but now adapted to use order cycles --- spec/controllers/enterprises_controller_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/controllers/enterprises_controller_spec.rb b/spec/controllers/enterprises_controller_spec.rb index fb06d69c46..852eb707de 100644 --- a/spec/controllers/enterprises_controller_spec.rb +++ b/spec/controllers/enterprises_controller_spec.rb @@ -81,6 +81,18 @@ describe EnterprisesController, type: :controller do controller.current_order.line_items.size.should == 0 end + it "should not empty an order if returning to the same distributor" do + product = create(:product) + create(:simple_order_cycle, distributors: [current_distributor], variants: [product.variants.first]) + line_item = create(:line_item, variant: product.variants.first) + controller.current_order.line_items << line_item + + spree_get :shop, {id: current_distributor} + + expect(controller.current_order.distributor).to eq current_distributor + expect(controller.current_order.line_items.first.variant).to eq product.variants.first + end + describe "when an out of stock item is in the cart" do let(:variant) { create(:variant, on_demand: false, on_hand: 10) } let(:line_item) { create(:line_item, variant: variant) }