diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/requests/api/topics_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/requests/api/topics_spec.rb')
-rw-r--r-- | spec/requests/api/topics_spec.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/spec/requests/api/topics_spec.rb b/spec/requests/api/topics_spec.rb index 5c17ca9581e..e711414a895 100644 --- a/spec/requests/api/topics_spec.rb +++ b/spec/requests/api/topics_spec.rb @@ -117,7 +117,7 @@ RSpec.describe API::Topics do describe 'POST /topics', :aggregate_failures do context 'as administrator' do it 'creates a topic' do - post api('/topics/', admin), params: { name: 'my-topic' } + post api('/topics/', admin), params: { name: 'my-topic', title: 'My Topic' } expect(response).to have_gitlab_http_status(:created) expect(json_response['name']).to eq('my-topic') @@ -128,7 +128,7 @@ RSpec.describe API::Topics do workhorse_form_with_file( api('/topics/', admin), file_key: :avatar, - params: { name: 'my-topic', description: 'my description...', avatar: file } + params: { name: 'my-topic', title: 'My Topic', description: 'my description...', avatar: file } ) expect(response).to have_gitlab_http_status(:created) @@ -137,23 +137,30 @@ RSpec.describe API::Topics do end it 'returns 400 if name is missing' do - post api('/topics/', admin) + post api('/topics/', admin), params: { title: 'My Topic' } expect(response).to have_gitlab_http_status(:bad_request) expect(json_response['error']).to eql('name is missing') end it 'returns 400 if name is not unique (case insensitive)' do - post api('/topics/', admin), params: { name: topic_1.name.downcase } + post api('/topics/', admin), params: { name: topic_1.name.downcase, title: 'My Topic' } expect(response).to have_gitlab_http_status(:bad_request) expect(json_response['message']['name']).to eq(['has already been taken']) end + + it 'returns 400 if title is missing' do + post api('/topics/', admin), params: { name: 'my-topic' } + + expect(response).to have_gitlab_http_status(:bad_request) + expect(json_response['error']).to eql('title is missing') + end end context 'as normal user' do it 'returns 403 Forbidden' do - post api('/topics/', user), params: { name: 'my-topic' } + post api('/topics/', user), params: { name: 'my-topic', title: 'My Topic' } expect(response).to have_gitlab_http_status(:forbidden) end @@ -161,7 +168,7 @@ RSpec.describe API::Topics do context 'as anonymous' do it 'returns 401 Unauthorized' do - post api('/topics/'), params: { name: 'my-topic' } + post api('/topics/'), params: { name: 'my-topic', title: 'My Topic' } expect(response).to have_gitlab_http_status(:unauthorized) end |