step "the order should be closed" do
  @order.reload
  @order.state.should == 'closed'
end

step "the order should be marked as delivered" do
  @order.reload
  @order.state.should == 'delivered'
end

step "another order is placed" do
  @new_order = @list.place_order(product_orders: [{ 'product_id' => @product.id, 'quantity' => 5}], user: @user, first_order: false)
end

step "the user order should be created as a new order" do
  @order = Order.last
  row = find(".order-row-#{@order.id}")
  row['class'].should include 'placed'
  #page.should have_content 'Apple pie (1), Heineken beer (2)'
  page.should have_content '1 x Apple pie', count: 1
  page.should have_content '2 x Heineken beer', count: 1
  page.should have_content '€ 8.96'
end

step "the user order gets marked as being in process" do
  step "the order gets marked as being in process"
end

step "the order gets marked as being in process" do
  @order.is_being_processed!
end

step "the user order should get feedback of being in process" do
  row = find(".order-row-#{@order.id}")
  row['class'].should include 'active'
end

step "the user order gets marked as being delivered" do
  @order.is_delivered!
end

step "the user order should get feedback of being delivered" do
  row = find(".order-row-#{@order.id}")
  row['class'].should include 'delivered'
end

step "the user orders list gets closed" do
  @order.list.close!
end

step "the order gets cancelled" do
  when_ember_is_ready { @order.cancel! }
end
