From 242459fae43d3e48b068ca27b9f2b69d3ee01d24 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 18 Jan 2022 12:12:37 +0100 Subject: [PATCH] Create the test that actually failed and should not --- .../system/consumer/shopping/shopping_spec.rb | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/system/consumer/shopping/shopping_spec.rb b/spec/system/consumer/shopping/shopping_spec.rb index e22b841bcf..2539e4476c 100644 --- a/spec/system/consumer/shopping/shopping_spec.rb +++ b/spec/system/consumer/shopping/shopping_spec.rb @@ -242,6 +242,30 @@ describe "As a consumer I want to shop with a distributor", js: true do expect(page).not_to have_content product.name end + context "when supplier uses property" do + let(:product3) { create(:simple_product, supplier: supplier, inherits_properties: false) } + + before do + add_variant_to_order_cycle(exchange, product3.variants.first) + property = create(:property, presentation: 'certified') + supplier.update!(properties: [property]) + end + + it "filters product by properties" do + visit shop_path + + expect(page).to have_content product2.name + expect(page).to have_content product3.name + + expect(page).to have_selector ".sticky-shop-filters-container .property-selectors span", text: "certified" + find(".sticky-shop-filters-container .property-selectors span", text: 'certified').click + expect(page).to have_content "Results for certified" + + expect(page).to have_content product2.name + expect(page).not_to have_content product3.name + end + end + it "returns search results for products where the search term matches one of the product's variant names" do visit shop_path fill_in "search", with: "Badg" # For variant with display_name "Badgers"