From b49de7d49eafbd8988f910abc288cf909d5d73d0 Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 16 Aug 2023 11:13:54 +1000 Subject: [PATCH] Simplify spec What if Zucchini didn't appear at all? Better to test that the two products appear on the same page, in the correct order. --- spec/system/admin/products_v3/products_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 5e97ca6910..1935200e6d 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -24,7 +24,7 @@ describe 'As an admin, I can see the new product page' do end describe "sorting" do - let!(:product_z) { create(:simple_product, name: "zucchini") } + let!(:product_z) { create(:simple_product, name: "Bananas") } let!(:product_a) { create(:simple_product, name: "Apples") } before do @@ -32,9 +32,7 @@ describe 'As an admin, I can see the new product page' do end it "Should sort products alphabetically by default" do - expect(page).to have_selector "table.products tbody tr td", text: "Apples" - # other products push later one to next page - expect(page).not_to have_selector "table.products tbody tr td", text: "zucchini" + expect(page).to have_content /Apples.*Bananas/ end end