mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user