diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/support/shared_examples/quick_actions | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/support/shared_examples/quick_actions')
2 files changed, 56 insertions, 39 deletions
diff --git a/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb index 159660e7d1d..910805dbdea 100644 --- a/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb @@ -47,7 +47,7 @@ RSpec.shared_examples 'create_merge_request quick action' do expect(created_mr.source_branch).to eq(issue.to_branch_name) visit project_merge_request_path(project, created_mr) - expect(page).to have_content %{WIP: Resolve "#{issue.title}"} + expect(page).to have_content %{Draft: Resolve "#{issue.title}"} end it 'creates a merge request using the given branch name' do @@ -60,7 +60,7 @@ RSpec.shared_examples 'create_merge_request quick action' do expect(created_mr.source_branch).to eq(branch_name) visit project_merge_request_path(project, created_mr) - expect(page).to have_content %{WIP: Resolve "#{issue.title}"} + expect(page).to have_content %{Draft: Resolve "#{issue.title}"} end end end diff --git a/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb index e0edbc5637a..258d9ab85e4 100644 --- a/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb @@ -1,68 +1,85 @@ # frozen_string_literal: true RSpec.shared_examples 'merge quick action' do - context 'when the current user can merge the MR' do + context 'when updating the description' do before do sign_in(user) - visit project_merge_request_path(project, merge_request) + visit edit_project_merge_request_path(project, merge_request) end - it 'merges the MR', :sidekiq_might_not_need_inline do - add_note("/merge") - - expect(page).to have_content 'Merged this merge request.' + it 'merges the MR', :sidekiq_inline do + fill_in('Description', with: '/merge') + click_button('Save changes') + expect(page).to have_content('Merged') expect(merge_request.reload).to be_merged end + end - context 'when auto merge is avialable' do + context 'when creating a new note' do + context 'when the current user can merge the MR' do before do - create(:ci_pipeline, :detached_merge_request_pipeline, - project: project, merge_request: merge_request) - merge_request.update_head_pipeline + sign_in(user) + visit project_merge_request_path(project, merge_request) end - it 'schedules to merge the MR' do + it 'merges the MR', :sidekiq_inline do add_note("/merge") - expect(page).to have_content "Scheduled to merge this merge request (Merge when pipeline succeeds)." + expect(page).to have_content 'Merged this merge request.' - expect(merge_request.reload).to be_auto_merge_enabled - expect(merge_request.reload).not_to be_merged + expect(merge_request.reload).to be_merged end - end - end - context 'when the head diff changes in the meanwhile' do - before do - merge_request.source_branch = 'another_branch' - merge_request.save - sign_in(user) - visit project_merge_request_path(project, merge_request) - end + context 'when auto merge is available' do + before do + create(:ci_pipeline, :detached_merge_request_pipeline, + project: project, merge_request: merge_request) + merge_request.update_head_pipeline + end - it 'does not merge the MR' do - add_note("/merge") + it 'schedules to merge the MR' do + add_note("/merge") - expect(page).not_to have_content 'Your commands have been executed!' + expect(page).to have_content "Scheduled to merge this merge request (Merge when pipeline succeeds)." - expect(merge_request.reload).not_to be_merged + expect(merge_request.reload).to be_auto_merge_enabled + expect(merge_request.reload).not_to be_merged + end + end end - end - context 'when the current user cannot merge the MR' do - before do - project.add_guest(guest) - sign_in(guest) - visit project_merge_request_path(project, merge_request) + context 'when the head diff changes in the meanwhile' do + before do + merge_request.source_branch = 'another_branch' + merge_request.save + sign_in(user) + visit project_merge_request_path(project, merge_request) + end + + it 'does not merge the MR' do + add_note("/merge") + + expect(page).not_to have_content 'Your commands have been executed!' + + expect(merge_request.reload).not_to be_merged + end end - it 'does not merge the MR' do - add_note("/merge") + context 'when the current user cannot merge the MR' do + before do + project.add_guest(guest) + sign_in(guest) + visit project_merge_request_path(project, merge_request) + end + + it 'does not merge the MR' do + add_note("/merge") - expect(page).not_to have_content 'Your commands have been executed!' + expect(page).not_to have_content 'Your commands have been executed!' - expect(merge_request.reload).not_to be_merged + expect(merge_request.reload).not_to be_merged + end end end end |