diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/requests/api/issues | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/requests/api/issues')
-rw-r--r-- | spec/requests/api/issues/issues_spec.rb | 15 | ||||
-rw-r--r-- | spec/requests/api/issues/post_projects_issues_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/issues/put_projects_issues_spec.rb | 4 |
3 files changed, 17 insertions, 6 deletions
diff --git a/spec/requests/api/issues/issues_spec.rb b/spec/requests/api/issues/issues_spec.rb index dd7d32f3565..f5c73846173 100644 --- a/spec/requests/api/issues/issues_spec.rb +++ b/spec/requests/api/issues/issues_spec.rb @@ -1164,6 +1164,21 @@ RSpec.describe API::Issues do expect(json_response['title']).to eq('new issue') expect(json_response['issue_type']).to eq('issue') end + + context 'when issue create service returns an unrecoverable error' do + before do + allow_next_instance_of(Issues::CreateService) do |create_service| + allow(create_service).to receive(:execute).and_return(ServiceResponse.error(message: 'some error', http_status: 403)) + end + end + + it 'returns and error message and status code from the service' do + post api("/projects/#{project.id}/issues", user), params: { title: 'new issue' } + + expect(response).to have_gitlab_http_status(:forbidden) + expect(json_response['message']).to eq('some error') + end + end end describe 'PUT /projects/:id/issues/:issue_iid' do diff --git a/spec/requests/api/issues/post_projects_issues_spec.rb b/spec/requests/api/issues/post_projects_issues_spec.rb index 7c8994ad9ba..3883eb01391 100644 --- a/spec/requests/api/issues/post_projects_issues_spec.rb +++ b/spec/requests/api/issues/post_projects_issues_spec.rb @@ -274,9 +274,7 @@ RSpec.describe API::Issues do post api("/projects/#{project.id}/issues", user), params: { title: 'g' * 256 } expect(response).to have_gitlab_http_status(:bad_request) - expect(json_response['message']['title']).to eq([ - 'is too long (maximum is 255 characters)' - ]) + expect(json_response['message']['title']).to eq(['is too long (maximum is 255 characters)']) end context 'resolving discussions' do diff --git a/spec/requests/api/issues/put_projects_issues_spec.rb b/spec/requests/api/issues/put_projects_issues_spec.rb index 6ea77cc6578..d6c57b460e0 100644 --- a/spec/requests/api/issues/put_projects_issues_spec.rb +++ b/spec/requests/api/issues/put_projects_issues_spec.rb @@ -381,9 +381,7 @@ RSpec.describe API::Issues do put api_for_user, params: { title: 'g' * 256 } expect(response).to have_gitlab_http_status(:bad_request) - expect(json_response['message']['title']).to eq([ - 'is too long (maximum is 255 characters)' - ]) + expect(json_response['message']['title']).to eq(['is too long (maximum is 255 characters)']) end end |