diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2018-08-21 10:56:34 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2018-08-21 10:56:34 +0200 |
commit | ceaee58c491a4c027f0e81fae0ad345028e6795a (patch) | |
tree | bc57a4b9f32e022d53b6c6b9c8b2289b5a2fb4c2 /spec/requests | |
parent | cc9764acd049776a40b2188f72436b824f5b0d1a (diff) | |
download | gitlab-ce-ceaee58c491a4c027f0e81fae0ad345028e6795a.tar.gz |
API: Catch empty commit messages
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/files_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index 0aec186f738..20992362b8c 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -337,6 +337,18 @@ describe API::Files do expect(response).to have_gitlab_http_status(400) end + it 'returns a 400 bad request if the commit message is empty' do + invalid_params = { + branch: 'master', + content: 'puts 8', + commit_message: '' + } + + post api(route(file_path), user), invalid_params + + expect(response).to have_gitlab_http_status(400) + end + it "returns a 400 if editor fails to create file" do allow_any_instance_of(Repository).to receive(:create_file) .and_raise(Gitlab::Git::CommitError, 'Cannot create file') |