diff --git a/spec/acceptance/suppliers/product_category_generation.feature b/spec/acceptance/suppliers/product_category_generation.feature index a11097c5..8912e7ab 100644 --- a/spec/acceptance/suppliers/product_category_generation.feature +++ b/spec/acceptance/suppliers/product_category_generation.feature @@ -11,8 +11,9 @@ Feature: Adding product category 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 unchecks the first product and checks the last product And the supplier clicks on the tuesday and wednesday buttons selecting wednesday as active day And the supplier submits the product category form + Then the the product category is active on wednesday and only linked to the last product diff --git a/spec/acceptance_steps/suppliers/product_category_steps.rb b/spec/acceptance_steps/suppliers/product_category_steps.rb index aa2841ca..1291d70c 100644 --- a/spec/acceptance_steps/suppliers/product_category_steps.rb +++ b/spec/acceptance_steps/suppliers/product_category_steps.rb @@ -32,3 +32,20 @@ step "the supplier clicks on the edit product category button" do find('.edit-resource-button').click end end + +step "the supplier unchecks the first product and checks the last product" do + find("#product-checker-#{@products.first.id}").set false + find("#product-checker-#{@products.last.id}").set true +end + +step "the supplier clicks on the tuesday and wednesday buttons selecting wednesday as active day" do + find('[data-day="tuesday"]').click + find('[data-day="wednesday"]').click +end + +step "the the product category is active on wednesday and only linked to the last product" do + sleep 1 + @product_category.reload + @product_category.week_days.should == [0, 0, 0, 1, 0, 0, 0] + @product_category.product_ids.should == [@products.last.id] +end