mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Spec current order cancellation amending backorder
The cancellation happens async in Javascript. Therefore we need to wait for and outcome on the page to know that the action finished. The expectation needs to be around that whole block. We actually want only one job enqueued if the same backorder is affected. Time to fix that.
This commit is contained in:
@@ -467,18 +467,21 @@ RSpec.describe '
|
||||
}.not_to enqueue_mail
|
||||
end
|
||||
|
||||
expect(page).not_to have_content "This will cancel the current order."
|
||||
|
||||
page.find("span.icon-reorder", text: "Actions").click
|
||||
within ".ofn-drop-down .menu" do
|
||||
page.find("span", text: "Cancel Orders").click
|
||||
end
|
||||
|
||||
within ".reveal-modal" do
|
||||
expect {
|
||||
expect {
|
||||
within ".reveal-modal" do
|
||||
click_on "Confirm" # Confirms the cancel action
|
||||
}.not_to enqueue_mail
|
||||
end
|
||||
|
||||
expect(page).to have_content("CANCELLED", count: 2)
|
||||
end
|
||||
expect(page).to have_content("CANCELLED", count: 2)
|
||||
}.to enqueue_job(AmendBackorderJob).exactly(:twice)
|
||||
# You can't combine negative matchers.
|
||||
.and enqueue_mail.exactly(0).times
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user