mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user