Speccing and fixing user list loading and adding orders to other users

This commit is contained in:
2014-08-28 18:07:30 +02:00
parent af4510cdc6
commit 14791df379
9 changed files with 66 additions and 1 deletions
@@ -32,3 +32,12 @@ Feature: Active list view
And I wait 1 second
Then the user should not see the order in the active list view
And the supplier orders in process counter for the user should be 0
@javascript
Scenario: Two users on the same list when one place an order
Given There is an open supplier with a menu
And there is a signed in user with an active order
And the user is on the active list page
And there is another signed in user on the same list
When the other user orders a product 5 times
Then the original user should see the newly placed order
@@ -36,3 +36,15 @@ Feature: Ordering a product as a user
And the user clicks on the user order button
Then an order with 2 products 'Heineken beer' should have been created
And no order for the product 'Apple pie' should have been created
@javascript
Scenario: Loading lists and switching to the order products view works, lists loading may unlink active list orders
Given There is an open supplier with a menu
And there is a signed in user with an active order
And I wait 1 second
And the user is on the order products page
When the user opens the side menu
And the user clicks on the lists link in the side menu
And the user opens the side menu again
And the user clicks on the order products link in the side menu
Then the user should see the products listed for the active list
@@ -13,3 +13,8 @@ end
step "the supplier counters in the user active list view should be updated" do
binding.pry
end
step "the original user should see the newly placed order" do
Capybara.session_name = :default
page.should have_content '5 x'
end
@@ -37,6 +37,22 @@ step "there is a signed in user with a placed order" do
step "the user has a placed order"
end
step "there is another signed in user on the same list" do
step 'there is another signed in user user'
step 'the other user is part of the list'
end
step 'the other user orders a product :count times' do |count|
@list.place_order products: {@product.id => count.to_i}, user: @other_user
end
step 'the other user is part of the list' do
@other_user.active_list_id = @list.id
@list.user_ids = @list.user_ids | [@other_user.id]
@other_user.save
@list.save
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)
find(".order-product-#{product.id} .show-product-description").click
@@ -80,3 +96,12 @@ step "the user should see an empty active order panel" do
no_orders_message = page.evaluate_script(%|t('product_orders.no_orders')|)
page.find('.product-orders').text.should == no_orders_message
end
step 'the user is on the order products page' do
visit "/user#/tables/#{@table.id}"
end
step 'the user should see the products listed for the active list' do
page.should have_content @heineken_beer.name
page.should have_content @apple_pie.name
end
@@ -13,3 +13,7 @@ end
step "the user clicks on the active list link in the side menu" do
page.execute_script %|$('.side-menu-active-list').click()|
end
step "the user clicks on the order products link in the side menu" do
page.execute_script %|$('.side-menu-list-products').click()|
end