Passing spec for user product information
This commit is contained in:
@@ -5,8 +5,7 @@ Feature: Getting product information during an order
|
||||
Given There is an open supplier with a menu
|
||||
And the product 'Heineken beer' has description 'Brewed in Amsterdam'
|
||||
And I am signed in as a user
|
||||
#And I open the debugger
|
||||
And I am on the user homepage
|
||||
#When the user scans a table QR code
|
||||
#And the user clicks on the more info button for the product with name 'Heineken beer'
|
||||
#Then the page should have content 'Brewed in Amsterdam'
|
||||
When the user scans a table QR code
|
||||
And the user clicks on the more info button for the product with name 'Heineken beer'
|
||||
Then the user page should have product information 'Brewed in Amsterdam'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Serializers' do
|
||||
let(:serializer_classes){ Dir.glob(Rails.root.join('app/serializers/*_serializer.rb')).map{|f| File.basename(f).sub(/\.rb$/,'').classify.constantize}}
|
||||
describe 'classes' do
|
||||
it 'inherits from Qwaiter::Serializer' do
|
||||
serializer_classes.each do |serializer|
|
||||
serializer.ancestors.should include Qwaiter::Serializer
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user