summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-03-12 12:14:02 +0000
committerPhil Hughes <me@iamphill.com>2018-03-12 12:14:02 +0000
commit2475019b4adf1875eb6adc953d0c69b2717559ff (patch)
tree55677e123d737143488aaf2af170a6b509145711 /spec
parentbd26e012fcd50d0ff5c1ad7febc9d6355e43a6fc (diff)
parentaba1c07a3ea9284df911338461d8b1e2d2d6607e (diff)
downloadgitlab-ce-2475019b4adf1875eb6adc953d0c69b2717559ff.tar.gz
Merge branch '42814-fix-remove-source-branch-when-mwps' into 'master'
Fix "Remove source branch" button in MR widget during MWPS state Closes #42814 and #4281 See merge request gitlab-org/gitlab-ce!17192
Diffstat (limited to 'spec')
-rw-r--r--spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb6
-rw-r--r--spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js20
2 files changed, 13 insertions, 13 deletions
diff --git a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb
index 890774922aa..db92a3504f3 100644
--- a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb
+++ b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb
@@ -125,6 +125,12 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
expect(page).to have_content "canceled the automatic merge"
end
+ it 'allows to remove source branch' do
+ click_link "Remove source branch"
+
+ expect(page).to have_content "The source branch will be removed"
+ end
+
context 'when pipeline succeeds' do
before do
build.success
diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js
index dd907ad9015..d47815a5b5a 100644
--- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js
+++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js
@@ -1,5 +1,6 @@
import Vue from 'vue';
import mwpsComponent from '~/vue_merge_request_widget/components/states/mr_widget_merge_when_pipeline_succeeds.vue';
+import MRWidgetService from '~/vue_merge_request_widget/services/mr_widget_service';
import eventHub from '~/vue_merge_request_widget/event_hub';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
@@ -25,12 +26,7 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
targetBranchPath,
targetBranch,
},
- service: {
- cancelAutomaticMerge() {},
- mergeResource: {
- save() {},
- },
- },
+ service: new MRWidgetService({}),
});
});
@@ -90,18 +86,16 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
describe('removeSourceBranch', () => {
it('should set flag and call service then request main component to update the widget', (done) => {
- spyOn(vm.service.mergeResource, 'save').and.returnValue(new Promise((resolve) => {
- resolve({
- data: {
- status: 'merge_when_pipeline_succeeds',
- },
- });
+ spyOn(vm.service, 'merge').and.returnValue(Promise.resolve({
+ data: {
+ status: 'merge_when_pipeline_succeeds',
+ },
}));
vm.removeSourceBranch();
setTimeout(() => {
expect(eventHub.$emit).toHaveBeenCalledWith('MRWidgetUpdateRequested');
- expect(vm.service.mergeResource.save).toHaveBeenCalledWith({
+ expect(vm.service.merge).toHaveBeenCalledWith({
sha,
merge_when_pipeline_succeeds: true,
should_remove_source_branch: true,