mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-25 01:23:23 +00:00
Add error message if adding a voucher fails
It's not really useful to the user but better than failing silently
This commit is contained in:
committed by
Maikel Linke
parent
596c775af6
commit
3f609d3842
@@ -279,7 +279,16 @@ describe SplitCheckoutController, type: :controller do
|
||||
end
|
||||
|
||||
context "when adding fails" do
|
||||
pending "returns 422 and an error message"
|
||||
it "returns 422 and an error message" do
|
||||
# Makes adding the voucher fails
|
||||
allow(voucher).to receive(:compute_amount).and_return(0)
|
||||
allow(Voucher).to receive(:find_by).and_return(voucher)
|
||||
|
||||
put :update, params: params
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(flash[:error]).to match "There was an error while adding the voucher"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user