Restructures spec to accommodate shared example on bulk printing

This commit is contained in:
filipefurtad0
2024-06-19 16:52:36 -06:00
parent 59b6cdaf01
commit 3380175c30

View File

@@ -140,25 +140,29 @@ RSpec.describe '
end
end
it "can bulk send confirmation email from 2 orders" do
page.find("#listing_orders tbody tr:nth-child(1) input[name='bulk_ids[]']").click
page.find("#listing_orders tbody tr:nth-child(2) input[name='bulk_ids[]']").click
shared_examples "can bulk send confirmation email from 2 orders" do
it "bulk prints invoices in pdf format" do
page.find("#listing_orders tbody tr:nth-child(1) input[name='bulk_ids[]']").click
page.find("#listing_orders tbody tr:nth-child(2) input[name='bulk_ids[]']").click
page.find("span.icon-reorder", text: "ACTIONS").click
within ".ofn-drop-down .menu" do
page.find("span", text: "Resend Confirmation").click
page.find("span.icon-reorder", text: "ACTIONS").click
within ".ofn-drop-down .menu" do
page.find("span", text: "Resend Confirmation").click
end
expect(page).to have_content "Are you sure you want to proceed?"
within ".reveal-modal" do
expect {
find_button("Confirm").click
}.to enqueue_job(ActionMailer::MailDeliveryJob).exactly(:twice)
end
expect(page).to have_content "Confirmation emails sent for 2 orders."
end
expect(page).to have_content "Are you sure you want to proceed?"
within ".reveal-modal" do
expect {
find_button("Confirm").click
}.to enqueue_job(ActionMailer::MailDeliveryJob).exactly(:twice)
end
expect(page).to have_content "Confirmation emails sent for 2 orders."
end
it_behaves_like "can bulk send confirmation email from 2 orders"
end
context "can bulk print invoices" do