diff options
author | Adam Niedzielski <adamsunday@gmail.com> | 2016-12-09 11:12:38 +0100 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2016-12-09 12:10:26 +0100 |
commit | 9190cea21524f936c0ae8a9e754c861f13583fc5 (patch) | |
tree | d211f9276213d7db90d9a7e8f6482172d342b331 /spec | |
parent | aa0a7aa3b5ba59b772f4d0c0bd061d278295b01f (diff) | |
download | gitlab-ce-9190cea21524f936c0ae8a9e754c861f13583fc5.tar.gz |
Do not reload diff for merge request made from fork when target branch in fork is updateddo-not-refresh-main-when-fork-target-branch-updated
The target branch of a merge request has to be a branch in the project
for which the merge request is submitted. When a branch changes in a fork,
it does not make sense to reload diffs of merge requests in the upstream
project that use the same branch name as the target branch.
Please note that it does make sense to reload diffs when the source branch
changes.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/merge_requests/refresh_service_spec.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb index bc340ff9d3c..7e3705983fb 100644 --- a/spec/services/merge_requests/refresh_service_spec.rb +++ b/spec/services/merge_requests/refresh_service_spec.rb @@ -126,17 +126,27 @@ describe MergeRequests::RefreshService, services: true do end context 'push to fork repo target branch' do - before do - service.new(@fork_project, @user).execute(@oldrev, @newrev, 'refs/heads/feature') - reload_mrs + describe 'changes to merge requests' do + before do + service.new(@fork_project, @user).execute(@oldrev, @newrev, 'refs/heads/feature') + reload_mrs + end + + it { expect(@merge_request.notes).to be_empty } + it { expect(@merge_request).to be_open } + it { expect(@fork_merge_request.notes).to be_empty } + it { expect(@fork_merge_request).to be_open } + it { expect(@build_failed_todo).to be_pending } + it { expect(@fork_build_failed_todo).to be_pending } end - it { expect(@merge_request.notes).to be_empty } - it { expect(@merge_request).to be_open } - it { expect(@fork_merge_request.notes).to be_empty } - it { expect(@fork_merge_request).to be_open } - it { expect(@build_failed_todo).to be_pending } - it { expect(@fork_build_failed_todo).to be_pending } + describe 'merge request diff' do + it 'does not reload the diff of the merge request made from fork' do + expect do + service.new(@fork_project, @user).execute(@oldrev, @newrev, 'refs/heads/feature') + end.not_to change { @fork_merge_request.reload.merge_request_diff } + end + end end context 'push to origin repo target branch after fork project was removed' do |