Add a spec on canceling an order, and check email is sent

Co-Authored-By: Maikel <maikel@email.org.au>
This commit is contained in:
Jean-Baptiste Bellet
2022-03-30 09:41:57 +02:00
parent 6a48bdbb82
commit 20142ca632

View File

@@ -208,6 +208,22 @@ describe '
end
end
context "user can cancel an order" do
before do
login_as_admin_and_visit spree.edit_admin_order_path(order)
end
it "by clicking on the cancel button" do
expect do
accept_alert do
click_button "Cancel"
end
expect(page).to have_content "Order updated"
expect(order.reload.state).to eq("canceled")
end.to have_enqueued_mail(Spree::OrderMailer, :cancel_email)
end
end
it "can't add more items than are available" do
# Move the order back to the cart state
order.state = 'cart'