Clean up spec

There's no "COPY OF" product in the spec setup, so we don't need to check that it's not there. (unless maybe we added that to the product factory, but it seems unlikely).

Also we can use helper method.
This commit is contained in:
David Cook
2026-02-10 11:30:57 +11:00
parent 1332051a6e
commit 0f3b299544

View File

@@ -246,24 +246,12 @@ RSpec.describe 'As an enterprise user, I can perform actions on the products scr
describe "Cloning product" do
it "shows the cloned product on page when clicked on the cloned option" do
# TODO, variant supplier missing, needs to be copied from variant and not product
within "table.products" do
# Gather input values, because page.content doesn't include them.
input_content = page.find_all('input[type=text]').map(&:value).join
# Products does not include the cloned product.
expect(input_content).not_to match /COPY OF Apples/
end
click_product_clone "Apples"
expect(page).to have_content "Successfully cloned the product"
within "table.products" do
# Gather input values, because page.content doesn't include them.
input_content = page.find_all('input[type=text]').map(&:value).join
# Products include the cloned product.
expect(input_content).to match /COPY OF Apples/
# Product list includes the cloned product.
expect(all_input_values).to match /COPY OF Apples/
end
end
end