Spec fixes
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
step "there is an open supplier with a menu" do
|
||||
step 'there is a confirmed and open supplier'
|
||||
@apple_pie= create :product, name: 'Apple pie', supplier: @supplier, price: 4.28
|
||||
@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
|
||||
@category_lunch = create :product_category, name: 'Lunch', supplier: @supplier
|
||||
@category_beer = create :product_category, name: 'Beer', supplier: @supplier
|
||||
|
||||
@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
|
||||
end
|
||||
|
||||
step "the supplier is in :time_zone" do |time_zone|
|
||||
|
||||
@@ -3,9 +3,9 @@ step "the supplier visits the new product category page" do
|
||||
visit new_suppliers_product_category_path
|
||||
end
|
||||
|
||||
step "the supplier fills in the new product category form selecting available on tuesdays" do
|
||||
step "the supplier fills in the new product category form selecting not available on tuesdays" do
|
||||
# default all days on, so click on tuesday deactivates it
|
||||
within '.modal' do
|
||||
|
||||
find('.form-row.name input').set 'New product category'
|
||||
find('.form-row.tuesday label').click
|
||||
end
|
||||
@@ -82,8 +82,8 @@ step "there is a product category with product available on :day between :catego
|
||||
start_minute = (Time.parse(category_start_time).seconds_since_midnight / 60).round
|
||||
end_minute = (Time.parse(category_end_time).seconds_since_midnight / 60).round
|
||||
end_minute += 1440 if end_minute < start_minute #night offset option
|
||||
@product_category = create :product_category,
|
||||
supplier: @supplier,
|
||||
@product_category = create :product_category,
|
||||
supplier: @supplier,
|
||||
week_days: [0,0,0,0,0,1,0],
|
||||
product_ids: [@product.id],
|
||||
start_from: start_minute,
|
||||
|
||||
@@ -4,7 +4,7 @@ end
|
||||
|
||||
step "the supplier submits the supplier settings form" do
|
||||
find('.submit-supplier-settings').click
|
||||
sleep 1 # give application some time
|
||||
sleep 1.5 # give application some time
|
||||
end
|
||||
|
||||
step "the supplier email should not have been changed" do
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
step "the supplier opens the side menu" do
|
||||
page.execute_script %|$('.toggle-side-menu').click()|
|
||||
sleep 1
|
||||
end
|
||||
|
||||
step "the supplier name in the side menu should be :name" do |name|
|
||||
expect( find('.side-menu .supplier-name').text ).to eq name
|
||||
end
|
||||
@@ -1,17 +1,24 @@
|
||||
|
||||
step "the supplier visits the new table page" do
|
||||
visit new_suppliers_table_path
|
||||
step "the supplier visits the tables page" do
|
||||
visit "/supplier#/tables"
|
||||
end
|
||||
|
||||
step "the supplier clicks on the new table button" do
|
||||
find('.new-table-button').click
|
||||
end
|
||||
|
||||
step "the supplier fills in the new table form selecting the first section" do
|
||||
find('#table_number').set '7'
|
||||
section_option = find(%|option[value="#{@sections.first.id}"]|)
|
||||
select section_option.text, from: 'table_section_id'
|
||||
within '.modal' do
|
||||
find('.number input').set '7'
|
||||
find('.section select').find(%|option[value="#{@sections.first.id}"]|).select_option
|
||||
end
|
||||
end
|
||||
|
||||
step "the supplier submits the table form" do
|
||||
#find('.save-table-button').click
|
||||
find('.form-action-submit').click
|
||||
within '.modal' do
|
||||
find('.modal-confirm').click
|
||||
end
|
||||
end
|
||||
|
||||
step "the new supplier table with proper properties should have been created" do
|
||||
@@ -19,23 +26,20 @@ step "the new supplier table with proper properties should have been created" do
|
||||
@table.section_id.should == @sections.first.id
|
||||
end
|
||||
|
||||
step "the supplier should be on the table section page" do
|
||||
step "the supplier clicks on the edit table button" do
|
||||
@table.reload
|
||||
route_should_be 'suppliers/sections#show', id: @table.section_id
|
||||
end
|
||||
|
||||
step "the supplier visits the edit table page" do
|
||||
visit edit_suppliers_table_path(@table)
|
||||
find('.table-edit').click
|
||||
end
|
||||
|
||||
step "the supplier changes the table number to :number and section to the last section" do |number|
|
||||
find('#table_number').set number
|
||||
section_option = find(%|option[value="#{@sections.last.id}"]|)
|
||||
select section_option.text, from: 'table_section_id'
|
||||
within '.modal' do
|
||||
find('.number input').set number
|
||||
find('.section select').find(%|option[value="#{@sections.last.id}"]|).select_option
|
||||
end
|
||||
end
|
||||
|
||||
step "the supplier table should have number :number and be linked to the last section" do |number|
|
||||
@table.reload
|
||||
@table.number.should == number.to_i
|
||||
@table.section_id.should == @sections.last.id
|
||||
expect( @table.number ).to eq number.to_i
|
||||
expect( @table.section_id ).to eq @sections.last.id
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user