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
@@ -25,6 +25,17 @@ Feature: Ordering a product as a user
When the user orders list gets closed
Then the user should be redirected to the archived list path
@javascript
Scenario: Order a product with product variants
Given there is an open supplier with a menu
And I am signed in as a user
And I am on the user homepage
When the user scans a table QR code
And the user clicks on the order product button 'Australian beer'
And the user selects the product variant 'Without foam'
Then the user order 'Australian beer' with variant 'Without foam' should be in the order list
#TODO: MORE ADVANCED TEST
@javascript
Scenario: Resetting an active order
Given there is an open supplier with a menu
+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
+6
View File
@@ -0,0 +1,6 @@
FactoryGirl.define do
factory :product_variant do
sequence(:name){|i| "Variant #{i}"}
association :product
end
end