Start supplier product category speccing
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
Feature: Adding product category
|
||||
|
||||
@javascript
|
||||
Scenario: Adding a product category
|
||||
Given there is a confirmed and open supplier
|
||||
And I am signed in as supplier
|
||||
And there are 2 supplier products
|
||||
And the supplier visits the new product category page
|
||||
And the supplier fills in the new product category form selecting the first product and available on tuesdays
|
||||
When the supplier submits the product category form
|
||||
Then then new product category with proper properties linked to the first product should have been created
|
||||
And the supplier should be on the product categoy overview path
|
||||
When the supplier clicks on the edit product category button
|
||||
And the supplier unchecks the first product and checks the product
|
||||
And the supplier clicks on the tuesday and wednesday buttons selecting wednesday as active day
|
||||
And the supplier submits the product category form
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user