Fix product ordering pricing and improve acceptance user product ordering coverage
This commit is contained in:
@@ -45,3 +45,38 @@ end
|
||||
step "the user page should have product information :product_description" do |product_description|
|
||||
page.should have_content product_description
|
||||
end
|
||||
|
||||
step "the user order :product_name should be in the order list with price" do |product_name|
|
||||
concerning_product = Product.find_by_name(product_name)
|
||||
ember_order = ember_store['product_orders'].find{|po| po['product_id'] == concerning_product.id}
|
||||
quantity = ember_order['quantity']
|
||||
order_price = quantity * concerning_product.price
|
||||
within '.product-orders .product-order' do
|
||||
page.should have_content product_name
|
||||
if quantity > 1
|
||||
page.should have_content "#{quantity} x"
|
||||
end
|
||||
page.should have_content order_price
|
||||
end
|
||||
end
|
||||
|
||||
step "the user order total should not be visible for only one order" do
|
||||
page.should_not have_selector ".product-orders .total"
|
||||
end
|
||||
|
||||
step "the user order total should be visible with the correct total price" do
|
||||
within ".product-orders .total" do
|
||||
page.should have_content "8.96" # more dynamic in the future if needed
|
||||
end
|
||||
end
|
||||
|
||||
step "the user clicks on the clear order for the last order button" do
|
||||
within page.all('.product-orders .product-order').last do
|
||||
find('.product-order-remove').click
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user