summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-08-22 08:31:02 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-08-22 08:31:02 +0000
commit0ce1355273a2f9158d700badb6f9ac1b30fd26e7 (patch)
tree18017b2bb96bcb655e85aa9699a79a77332b55e8 /spec/requests
parente922750e89fde40d9f3c465d7b1f380943c464e3 (diff)
parent72b5c9af62be8d2b5531077e09517b09be189539 (diff)
downloadgitlab-ce-0ce1355273a2f9158d700badb6f9ac1b30fd26e7.tar.gz
Merge branch 'api-empty-project-snippets' into 'master'
Api empty project snippets Closes #50270 See merge request gitlab-org/gitlab-ce!21325
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/project_snippets_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/requests/api/project_snippets_spec.rb b/spec/requests/api/project_snippets_spec.rb
index a3b5e8c6223..5dec0bc778c 100644
--- a/spec/requests/api/project_snippets_spec.rb
+++ b/spec/requests/api/project_snippets_spec.rb
@@ -116,6 +116,14 @@ describe API::ProjectSnippets do
expect(response).to have_gitlab_http_status(400)
end
+ it 'returns 400 for empty code field' do
+ params[:code] = ''
+
+ post api("/projects/#{project.id}/snippets/", admin), params
+
+ expect(response).to have_gitlab_http_status(400)
+ end
+
context 'when the snippet is spam' do
def create_snippet(project, snippet_params = {})
project.add_developer(user)
@@ -180,6 +188,14 @@ describe API::ProjectSnippets do
expect(response).to have_gitlab_http_status(400)
end
+ it 'returns 400 for empty code field' do
+ new_content = ''
+
+ put api("/projects/#{snippet.project.id}/snippets/#{snippet.id}/", admin), code: new_content
+
+ expect(response).to have_gitlab_http_status(400)
+ end
+
context 'when the snippet is spam' do
def update_snippet(snippet_params = {})
put api("/projects/#{snippet.project.id}/snippets/#{snippet.id}", admin), snippet_params