Passing spec for user product information

This commit is contained in:
2014-04-23 17:06:46 +02:00
parent ea498cb9c5
commit 546e4499ea
42 changed files with 190 additions and 482 deletions
@@ -1,5 +1,6 @@
step "the product :product_name has description :product_description" do |product_name, product_description|
product = @product && @product.name == product_name ? @product : Product.find_by_name(product_name)
#product = @product && @product.name == product_name ? @product : Product.find_by_name(product_name)
product = Product.find_by_name(product_name)
product.description = product_description
product.save or raise "Cannot save product: #{product.errors.full_messages.to_sentence}"
@product ||= product
@@ -1,16 +1,3 @@
step "the user scans a table QR code" do
step 'there is a table'
page.execute_script "Quser.actions_for_table({table_id: '#{@table.id}'})"
end
step "another user scans the QR code on the table" do
step 'there is another signed in user user'
visit user_root_path
binding.pry
page.execute_script "Quser.actions_for_table({table_id: '#{@table.id}'})"
end
step 'there is a table' do
step 'there is a section'
@table ||= create :table, section: @section, supplier: @supplier
@@ -1,3 +1,16 @@
step "the user scans a table QR code" do
step 'there is a table'
#page.execute_script "Quser.actions_for_table({table_id: '#{@table.id}'})"
page.execute_script "App.__container__.lookup('route:application').transitionTo('table','#{@table.id}')"
end
step "another user scans the QR code on the table" do
step 'there is another signed in user user'
visit user_root_path
#page.execute_script "Quser.actions_for_table({table_id: '#{@table.id}'})"
page.execute_script "App.__container__.lookup('route:application').transitionTo('table','#{@table.id}')"
end
step "I am on the user homepage" do
step "the user is on the homepage"
end
+9 -5
View File
@@ -1,11 +1,15 @@
step "There is an open supplier with a menu" do
step 'there is a confirmed and open supplier'
@category_beer = create :product_category, name: 'Beer', supplier: @supplier
@category_lunch = create :product_category, name: 'Lunch', supplier: @supplier
@heineken_beer = create :product, name: 'Heineken beer', supplier: @supplier, price: 2.34
@apple_pie= create :product, name: 'Apple pie', supplier: @supplier, price: 4.28
@heineken_beer.add_product_category @category_beer
@apple_pie.add_product_category @category_lunch
@heineken_beer = create :product, name: 'Heineken beer', supplier: @supplier, price: 2.34
@category_beer = create :product_category, name: 'Beer', supplier: @supplier, product_ids: [@heineken_beer.id]
@category_lunch = create :product_category, name: 'Lunch', supplier: @supplier, product_ids: [@apple_pie.id]
#@heineken_beer.add_product_category @category_beer
#@category_beer.save
#@category_lunch.save
#@apple_pie.add_product_category @category_lunch
#@apple_pie.save
end
step "the supplier is in :time_zone" do |time_zone|
@@ -3,10 +3,6 @@ step "there is another table" do
@other_table = create :table, number: 89, section: @section, supplier: @supplier
end
step "the user scans a QR code of another not occupied table" do
page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})"
end
step "the user should see a popup asking the user if he would like to change table" do
move_table_body = page.evaluate_script "t('move_table.confirmation_body')"
move_table_body.should be_present
@@ -35,6 +31,10 @@ step "there is another table with an active list of another user" do
end
step "the user scans a QR code of another not occupied table" do
page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})"
end
step "the user scans a QR code of another occupied table" do
# same as not, since this is just a scan action. Whether the table
# is occupied is a responsibility of other steps
@@ -32,3 +32,7 @@ step "the user clicks on the more info button for the product with name :product
product = @product && @product.name == product_name ? @product : Product.find_by_name(product_name)
find(".order-product-#{product.id} .show-product-description").click
end
step "the user page should have product information :product_description" do |product_description|
page.should have_content product_description
end