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.
This commit is contained in:
David Cook
2023-08-16 11:13:54 +10:00
parent 1155bd42ea
commit b49de7d49e

View File

@@ -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