From 72d357a44c9c7153e44a30cad8aa064f1ed9e988 Mon Sep 17 00:00:00 2001 From: Madeline Collier Date: Thu, 12 Dec 2024 13:32:28 +0100 Subject: [PATCH] Appease Codecov with additional request spec case This should get us to 100% coverage for the StoreCreditsController! --- .../requests/solidus_admin/store_credits_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/admin/spec/requests/solidus_admin/store_credits_spec.rb b/admin/spec/requests/solidus_admin/store_credits_spec.rb index e5fbab8c5e..e7ebc7f6ac 100644 --- a/admin/spec/requests/solidus_admin/store_credits_spec.rb +++ b/admin/spec/requests/solidus_admin/store_credits_spec.rb @@ -58,6 +58,18 @@ follow_redirect! expect(response.body).to include("Store credit was successfully updated.") end + + context "when update_amount fails" do + before do + allow_any_instance_of(Spree::StoreCredit).to receive(:update_amount).and_return(false) + end + + it "renders the edit_amount template with errors" do + put solidus_admin.update_amount_user_store_credit_path(user, store_credit), params: { store_credit: valid_params } + + expect(response).to have_http_status(:unprocessable_entity) + end + end end context "with invalid parameters" do