Actually, those two tests are in the same context

The diff is pretty hard to read, but i've put the two tests "removes it from the product list" and "keeps the line item on the order (admin)" under the same context and the same `before` block
This commit is contained in:
Jean-Baptiste Bellet
2023-02-13 13:38:57 +01:00
parent 9ca25df934
commit 51272eef00

View File

@@ -190,24 +190,25 @@ describe '
let!(:order) { create(:shipped_order, line_items_count: 1) }
let!(:line_item) { order.reload.line_items.first }
before do
login_as_admin_and_visit spree.admin_products_path
within "#p_#{order.variants.first.product_id}" do
accept_alert { page.find("[data-powertip=Remove]").click }
end
visit current_path
end
it 'removes it from the product list' do
expect(page).to have_selector "#p_#{product1.id}"
expect(page).not_to have_selector "#p_#{order.variants.first.product_id}"
end
context "a deleted line item from a shipped order" do
before do
login_as_admin_and_visit spree.edit_admin_order_path(order)
login_as_admin_and_visit spree.admin_products_path
within "#p_#{order.variants.first.product_id}" do
accept_alert { page.find("[data-powertip=Remove]").click }
end
end
it 'removes it from the product list' do
visit spree.admin_products_path
expect(page).to have_selector "#p_#{product1.id}"
expect(page).not_to have_selector "#p_#{order.variants.first.product_id}"
end
it 'keeps the line item on the order (admin)' do
visit spree.edit_admin_order_path(order)
expect(page).to have_content(line_item.product.name.to_s)
end
end