Skip to content

Commit

Permalink
Re-add spec removed in product distributions removal but now adapted …
Browse files Browse the repository at this point in the history
…to use order cycles
  • Loading branch information
luisramos0 committed Mar 12, 2019
1 parent e055c8b commit e20865f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/controllers/enterprises_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@
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) }
Expand Down

0 comments on commit e20865f

Please sign in to comment.