From 62f73a4e4b7f4d3119516a1af99d09991b10b110 Mon Sep 17 00:00:00 2001 From: Vasilii Iakliushin Date: Mon, 27 Feb 2023 18:18:38 +0100 Subject: [PATCH] Fix typo in the error message rendering **Problem** Because of the typo, the endpoint doesn't render the error message. **Solution** Fix typo and add a test to verify the error message. Changelog: fixed --- app/controllers/projects/branches_controller.rb | 2 +- spec/controllers/projects/branches_controller_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index f19f143816f1e1..1e17dd586c73ca 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -98,7 +98,7 @@ def create if success render json: { name: branch_name, url: project_tree_url(@project, branch_name) } else - render json: result[:messsage], status: :unprocessable_entity + render json: result[:message], status: :unprocessable_entity end end end diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 55c148bb66feff..600f8047a1df87 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -277,6 +277,7 @@ def create_branch_with_confidential_issue_project create_branch name: "", ref: "" expect(response).to have_gitlab_http_status(:unprocessable_entity) + expect(response.body).to include 'Failed to create branch' end end -- GitLab