Product image and description handling
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
step "the supplier clicks on the new product category button" do
|
||||
find('.new-product_category-button').click
|
||||
end
|
||||
|
||||
@@ -23,6 +23,9 @@ step "I visit the supplier settings path" do
|
||||
visit "/supplier#/settings"
|
||||
end
|
||||
|
||||
step "the supplier visits the menu page" do
|
||||
visit "/supplier#/menu"
|
||||
end
|
||||
|
||||
## ASSERTIONS
|
||||
|
||||
|
||||
@@ -3,24 +3,47 @@ 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 the first product and available on tuesdays" do
|
||||
find('#product_category_name').set 'New product category'
|
||||
find("#product-checker-#{@products.first.id}").set true
|
||||
page.all('.week-day-toggle').each do |day_toggle|
|
||||
next if day_toggle['data-day'] == 'tuesday'
|
||||
day_toggle.click
|
||||
step "the supplier fills in the new product category form selecting available on tuesdays" do
|
||||
within '.modal' do
|
||||
|
||||
find('.form-row.name input').set 'New product category'
|
||||
find('.form-row.tuesday label').click
|
||||
end
|
||||
end
|
||||
|
||||
step "the supplier submits the product category form" do
|
||||
submit_form
|
||||
find('.modal .modal-save').click
|
||||
end
|
||||
|
||||
step "then new product category with proper properties linked to the first product should have been created" do
|
||||
step "then new product category with proper properties should have been created" do
|
||||
sleep 1
|
||||
@product_category = ProductCategory.find_by_name 'New product category'
|
||||
@product_category.week_days.should == [0, 0, 1, 0, 0, 0, 0]
|
||||
#@product_category.week_days.should == [0, 0, 1, 0, 0, 0, 0]
|
||||
@product_category.full_day.should be true
|
||||
@product_category.product_ids.should == [@products.first.id]
|
||||
expect( @product_category.active_on_monday ).to be false
|
||||
expect( @product_category.active_on_tuesday ).to be true
|
||||
#@product_category.product_ids.should == [@products.first.id]
|
||||
end
|
||||
|
||||
step "the supplier clicks on the add product button for the product category" do
|
||||
find('.add-product-product_category-button').click
|
||||
end
|
||||
|
||||
step "the supplier fills in the new product form and submits it" do
|
||||
within ('.menu-product-new') do
|
||||
find('.name input').set "Delicious pie"
|
||||
find('.price input').set "4.75"
|
||||
find('.code input').set "P079"
|
||||
find('.save-product-action').click
|
||||
sleep 0.5
|
||||
end
|
||||
end
|
||||
|
||||
step "the product created by the supplier should have been created" do
|
||||
product = Product.find_by_name('Delicious pie')
|
||||
expect( product.price ).to eq 4.75
|
||||
expect( product.code ).to eq "P079"
|
||||
expect( product.product_category ).to eq @product_category
|
||||
end
|
||||
|
||||
step "the supplier should be on the product categoy overview path" do
|
||||
|
||||
Reference in New Issue
Block a user