User cancelled order handling
This commit is contained in:
@@ -7,14 +7,18 @@ step "the list is marked as in need of payment" do
|
||||
@list.needs_payment!
|
||||
end
|
||||
|
||||
step "the user has an active list" do
|
||||
step "the user has an active list with a/an :order_status order" do |order_status|
|
||||
@list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id]
|
||||
@product ||= create :product, supplier: @supplier, name: 'Beer', price: 2.34
|
||||
@order = create :order, supplier: @supplier, list: @list
|
||||
@order = create :order, order_status.to_sym, supplier: @supplier, list: @list
|
||||
@product_order = create :product_order, order: @order, product: @product, quantity: 2, price: 2.34
|
||||
@user.reload
|
||||
@user.active_list_id = @list.id
|
||||
@user.save
|
||||
case order_status.to_sym
|
||||
when :placed then @supplier.increment_orders_placed_count!
|
||||
when :active then @supplier.increment_orders_in_process_count!
|
||||
end
|
||||
end
|
||||
|
||||
step "the list should be marked as closed" do
|
||||
|
||||
@@ -47,3 +47,7 @@ end
|
||||
step "the user orders list gets closed" do
|
||||
@order.list.close!
|
||||
end
|
||||
|
||||
step "the order gets cancelled" do
|
||||
@order.cancel!
|
||||
end
|
||||
|
||||
@@ -5,3 +5,11 @@ end
|
||||
step "the user should see the order in the active list view" do
|
||||
page.evaluate_script(%|$('.order-row-#{@order.id}').text()|).first(14).should == '2 x Beer€ 4.68'
|
||||
end
|
||||
|
||||
step "the user should not see the order in the active list view" do
|
||||
page.should_not have_selector ".order-row-#{@order.id}"
|
||||
end
|
||||
|
||||
step "the supplier counters in the user active list view should be updated" do
|
||||
binding.pry
|
||||
end
|
||||
|
||||
@@ -19,14 +19,23 @@ end
|
||||
step "the user has an active order" do
|
||||
step 'there is a section'
|
||||
step 'there is a table'
|
||||
step 'the user has an active list'
|
||||
step 'the user has an active list with an active order'
|
||||
end
|
||||
|
||||
step "the user has a placed order" do
|
||||
step 'there is a section'
|
||||
step 'there is a table'
|
||||
step 'the user has an active list with a placed order'
|
||||
end
|
||||
|
||||
step "there is a signed in user with an active order" do
|
||||
step "I am signed in as a user"
|
||||
step "the user has an active order"
|
||||
end
|
||||
step "there is a signed in user with a placed order" do
|
||||
step "I am signed in as a user"
|
||||
step "the user has a placed order"
|
||||
end
|
||||
|
||||
step "the user clicks on the more info button for the product with name :product_name" do |product_name|
|
||||
product = @product && @product.name == product_name ? @product : Product.find_by_name(product_name)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
step "the supplier orders placed counter for the user should be :count" do |count|
|
||||
page.find(".supplier-orders-placed-count").text.should == count # both string values
|
||||
end
|
||||
|
||||
step "the supplier orders in process counter for the user should be :count" do |count|
|
||||
page.find(".supplier-orders-in-process-count").text.should == count # both string values
|
||||
end
|
||||
Reference in New Issue
Block a user