summaryrefslogtreecommitdiff
path: root/spec/services/merge_requests
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-06-23 14:58:14 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-07-13 13:24:56 +0530
commit495db09653bafb0371e5d5a5f12d5bc33cdb584b (patch)
treea524d76e48cb8c34e414ac4ee422f33dfa6625e2 /spec/services/merge_requests
parentf0577d838544152f558411ef1101d56c5852d92e (diff)
downloadgitlab-ce-495db09653bafb0371e5d5a5f12d5bc33cdb584b.tar.gz
Enforce "developers can merge" during `pre-receive`.
1. When a merge request is being merged, save the merge commit SHA in the `in_progress_merge_commit_sha` database column. 2. The `pre-receive` hook looks for any locked (in progress) merge request with `in_progress_merge_commit_sha` matching the `newrev` it is passed. 3. If it finds a matching MR, the merge is legitimate. 4. Update `git_access_spec` to test the behaviour we added here. Also refactored this spec a bit to make it easier to add more contexts / conditions.
Diffstat (limited to 'spec/services/merge_requests')
-rw-r--r--spec/services/merge_requests/refresh_service_spec.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb
index 06f56d85aa8..ce643b3f860 100644
--- a/spec/services/merge_requests/refresh_service_spec.rb
+++ b/spec/services/merge_requests/refresh_service_spec.rb
@@ -88,8 +88,7 @@ describe MergeRequests::RefreshService, services: true do
# Merge master -> feature branch
author = { email: 'test@gitlab.com', time: Time.now, name: "Me" }
commit_options = { message: 'Test message', committer: author, author: author }
- master_commit = @project.repository.commit('master')
- @project.repository.merge(@user, master_commit.id, 'feature', commit_options)
+ @project.repository.merge(@user, @merge_request, commit_options)
commit = @project.repository.commit('feature')
service.new(@project, @user).execute(@oldrev, commit.id, 'refs/heads/feature')
reload_mrs