Commit 63849666 authored by Markus Koller's avatar Markus Koller

Merge branch 'cwoolley-gitlab-master-patch-20932' into 'master'

Fix typo in wiki.rb

See merge request gitlab-org/gitlab!56285
parents 2c48c8e8 5b392445
---
title: Fix bug in wiki page destroy API endpoint when an error is raised
merge_request: 56285
author:
type: fixed
......@@ -111,7 +111,7 @@ module API
if response.success?
no_content!
else
render_api_error!(reponse.message)
unprocessable_entity!(response.message)
end
end
......
......@@ -14,6 +14,7 @@ require 'spec_helper'
RSpec.describe API::Wikis do
include WorkhorseHelpers
include AfterNextHelpers
let(:user) { create(:user) }
let(:group) { create(:group).tap { |g| g.add_owner(user) } }
......@@ -578,6 +579,20 @@ RSpec.describe API::Wikis do
include_examples 'wiki API 404 Wiki Page Not Found'
end
end
context 'when there is an error deleting the page' do
it 'returns 422' do
project.add_maintainer(user)
allow_next(WikiPages::DestroyService, current_user: user, container: project)
.to receive(:execute).and_return(ServiceResponse.error(message: 'foo'))
delete(api(url, user))
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['message']).to eq 'foo'
end
end
end
context 'when wiki belongs to a group project' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment