diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-04-06 14:21:28 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-04-06 14:21:28 +0300 |
commit | d062af91ca10bb0c48136ad9b9204b02d41fdf8c (patch) | |
tree | c99d7a0af28992387c0f3efd610b9631a8de0a40 /spec/services/merge_requests | |
parent | a1db7c5b9fec34c9d4f5b262eeb836387b926e80 (diff) | |
parent | d5102cf75f5d4a1b4bcd15bca1732550ebdae125 (diff) |
Merge branch '30291-reopen-mr' into 'master'
Search for opened MRs - include reopened MRs
Closes #30291
See merge request !10407
Diffstat (limited to 'spec/services/merge_requests')
-rw-r--r-- | spec/services/merge_requests/refresh_service_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb index c22d145ca5d..03215a4624a 100644 --- a/spec/services/merge_requests/refresh_service_spec.rb +++ b/spec/services/merge_requests/refresh_service_spec.rb @@ -49,6 +49,7 @@ describe MergeRequests::RefreshService, services: true do context 'push to origin repo source branch' do let(:refresh_service) { service.new(@project, @user) } + before do allow(refresh_service).to receive(:execute_hooks) refresh_service.execute(@oldrev, @newrev, 'refs/heads/master') @@ -70,6 +71,32 @@ describe MergeRequests::RefreshService, services: true do end end + context 'push to origin repo source branch when an MR was reopened' do + let(:refresh_service) { service.new(@project, @user) } + + before do + @merge_request.update(state: :reopened) + + allow(refresh_service).to receive(:execute_hooks) + refresh_service.execute(@oldrev, @newrev, 'refs/heads/master') + reload_mrs + end + + it 'executes hooks with update action' do + expect(refresh_service).to have_received(:execute_hooks). + with(@merge_request, 'update', @oldrev) + + expect(@merge_request.notes).not_to be_empty + expect(@merge_request).to be_open + expect(@merge_request.merge_when_pipeline_succeeds).to be_falsey + expect(@merge_request.diff_head_sha).to eq(@newrev) + expect(@fork_merge_request).to be_open + expect(@fork_merge_request.notes).to be_empty + expect(@build_failed_todo).to be_done + expect(@fork_build_failed_todo).to be_done + end + end + context 'push to origin repo target branch' do before do service.new(@project, @user).execute(@oldrev, @newrev, 'refs/heads/feature') |