diff options
author | Mark Fletcher <mark@gitlab.com> | 2017-01-03 01:14:31 +0000 |
---|---|---|
committer | Mark Fletcher <mark@gitlab.com> | 2017-01-03 01:16:38 +0000 |
commit | 63fcf1373957115893fd635142a786aa816bb69a (patch) | |
tree | f93ec167f68bcddf222ed471939951707c015927 | |
parent | de25604fbca2f7005754d821d571bbcb1cc510ac (diff) | |
download | gitlab-ce-63fcf1373957115893fd635142a786aa816bb69a.tar.gz |
Fix Commits API to accept a Project path upon POST
-rw-r--r-- | changelogs/unreleased/26261-post-api-v3-projects-idorproject-commits-commits-does-not-work-with-project-path.yml | 4 | ||||
-rw-r--r-- | lib/api/commits.rb | 1 | ||||
-rw-r--r-- | spec/requests/api/commits_spec.rb | 10 |
3 files changed, 14 insertions, 1 deletions
diff --git a/changelogs/unreleased/26261-post-api-v3-projects-idorproject-commits-commits-does-not-work-with-project-path.yml b/changelogs/unreleased/26261-post-api-v3-projects-idorproject-commits-commits-does-not-work-with-project-path.yml new file mode 100644 index 00000000000..37bd7e46b49 --- /dev/null +++ b/changelogs/unreleased/26261-post-api-v3-projects-idorproject-commits-commits-does-not-work-with-project-path.yml @@ -0,0 +1,4 @@ +--- +title: Fix Commits API to accept a Project path upon POST +merge_request: +author: diff --git a/lib/api/commits.rb b/lib/api/commits.rb index cf2489dbb67..e6d707f3c3d 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -44,7 +44,6 @@ module API detail 'This feature was introduced in GitLab 8.13' end params do - requires :id, type: Integer, desc: 'The project ID' requires :branch_name, type: String, desc: 'The name of branch' requires :commit_message, type: String, desc: 'Commit message' requires :actions, type: Array[Hash], desc: 'Actions to perform in commit' diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index 964cded917c..7f8ea5251f0 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -146,6 +146,16 @@ describe API::Commits, api: true do expect(response).to have_http_status(400) end + + context 'with project path in URL' do + let(:url) { "/projects/#{project.namespace.path}%2F#{project.path}/repository/commits" } + + it 'a new file in project repo' do + post api(url, user), valid_c_params + + expect(response).to have_http_status(201) + end + end end context :delete do |