summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-06 18:49:40 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-06 18:49:40 +0200
commit9362f5939710bba322008aabd37a4962ddae6f2f (patch)
tree2c4cea2adfaa170732061c1710dfe74c4e8777b8 /spec/services
parent163e9f99ab29524bca204fbd0d0aabc1a1813e4a (diff)
parent46e4ed6bd0c8c256bce6d35b4bb992d77fd09971 (diff)
downloadgitlab-ce-9362f5939710bba322008aabd37a4962ddae6f2f.tar.gz
Merge commit '46e4ed6bd0c8c256bce6d35b4bb992d77fd09971' into feature/multi-level-container-registry-imagesfeature/multi-level-container-registry-images
* commit '46e4ed6bd0c8c256bce6d35b4bb992d77fd09971': (28 commits) Award emoji button smiley animation Introduced empty/error UX states to environments monitoring. Github import rake task Remove individual modal width styles Fix RuboCop for removing index Link to docs site for file in doc/ Disable invalid service templates (again) Show CI status as Favicon on Pipelines, Job and MR pages STL file viewer Wait for the PDF to be loaded before doing anything remove unnecessary lease as cron job Search for opened MRs - include reopened MRs ProjectsFinder should handle more options Clearly show who triggered the pipeline in email Make it possible to preview pipeline success/failed emails Add remove_concurrent_index to database helper Add more tests for subgroups feature Large features by the 1st, small ones by the 3rd Ask people to create EE MRs on the 7th fix project authorizations migration issue ...
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/merge_requests/refresh_service_spec.rb27
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')