summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-11-22 06:02:58 +0000
committerNick Thomas <nick@gitlab.com>2018-11-27 18:04:33 +0000
commit9f287298270b3a833bc53b9280c6e3c6a2f055b8 (patch)
tree3283dc7f49b6ec62f23e89f1811a539b21461b82 /spec
parent0afce35d65aa433d221e41632c6d8095ab68c39f (diff)
downloadgitlab-ce-9f287298270b3a833bc53b9280c6e3c6a2f055b8.tar.gz
Add a rebase API endpoint for merge requests
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/merge_requests_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index e4e0ca285e0..19602e7152a 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -1181,6 +1181,26 @@ describe API::MergeRequests do
end
end
+ describe 'PUT :id/merge_requests/:merge_request_iid/rebase' do
+ it 'enques a rebase of the merge request against the target branch' do
+ Sidekiq::Testing.fake! do
+ put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/rebase", user)
+ end
+
+ expect(response).to have_gitlab_http_status(202)
+ expect(RebaseWorker.jobs.size).to eq(1)
+ end
+
+ it 'returns 403 if the user cannot push to the branch' do
+ guest = create(:user)
+ project.add_guest(guest)
+
+ put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/rebase", guest)
+
+ expect(response).to have_gitlab_http_status(403)
+ end
+ end
+
describe 'Time tracking' do
let(:issuable) { merge_request }