Start supplier product category speccing

This commit is contained in:
2013-12-15 17:55:14 +01:00
parent 65aa99cc1a
commit 85297bed4f
5 changed files with 59 additions and 3 deletions
@@ -0,0 +1,34 @@
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
end
end
step "the supplier submits the product category form" do
submit_form
end
step "then new product category with proper properties linked to the first product 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.full_day.should be_true
@product_category.product_ids.should == [@products.first.id]
end
step "the supplier should be on the product categoy overview path" do
route_should_be "suppliers/product_categories#index"
end
step "the supplier clicks on the edit product category button" do
within "#product_category_#{@product_category.id}" do
find('.edit-resource-button').click
end
end
@@ -0,0 +1,4 @@
step "there are :count supplier products" do |count|
@products = create_list :product, count.to_i, supplier: @supplier
end