Product variant fix

This commit is contained in:
2015-08-13 16:53:34 +02:00
parent 0415603a49
commit 6e97f74b0a
23 changed files with 72 additions and 26 deletions
+3
View File
@@ -6,6 +6,9 @@ step "there is an open supplier with a menu" do
@apple_pie= create :product, name: 'Apple pie', supplier: @supplier, price: 4.28, product_category_id: @category_lunch.id
@heineken_beer = create :product, name: 'Heineken beer', supplier: @supplier, price: 2.34, product_category_id: @category_beer.id
@australian_beer = create :product, name: 'Australian beer', supplier: @supplier, price: 3.34, product_category_id: @category_beer.id
create :product_variant, product: @australian_beer, name: 'With foam'
create :product_variant, product: @australian_beer, name: 'Without foam'
@product = @heineken_beer # set @product for user order selection
end
@@ -82,6 +82,16 @@ 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 selects the product variant :variant" do |variant|
# Manual in stead of js_click because capybara does not support the contains statement
#find ".modal .choose-product-variant-button"
find ".modal"
page.evaluate_script %|$('.modal a:contains("#{variant}")').click()|
end
step "the user order :product_name with variant :variant should be in the order list" do |product_name, variant|
page.should have_content "1 x #{product_name} (#{variant})"
end
step "the user order total should be visible with the correct total price" do
within ".product-orders .total" do