Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-29 15:10:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-29 15:10:19 +0300
commitd15aa4cf2e1b1c55629f5b672366c5be40344aa5 (patch)
tree0b974d69a2046854d2edb01bff5f7a0429969bf2 /spec/support/shared_examples/quick_actions/merge_request/rebase_quick_action_shared_examples.rb
parent385d7ee6af36be869f681b368bd9c607b45cc4cd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/quick_actions/merge_request/rebase_quick_action_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/quick_actions/merge_request/rebase_quick_action_shared_examples.rb55
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/support/shared_examples/quick_actions/merge_request/rebase_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/merge_request/rebase_quick_action_shared_examples.rb
new file mode 100644
index 00000000000..2e8db16ad68
--- /dev/null
+++ b/spec/support/shared_examples/quick_actions/merge_request/rebase_quick_action_shared_examples.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'rebase quick action' do
+ context 'when updating the description' do
+ before do
+ sign_in(user)
+ visit edit_project_merge_request_path(project, merge_request)
+ end
+
+ it 'rebases the MR', :sidekiq_inline do
+ fill_in('Description', with: '/rebase')
+ click_button('Save changes')
+
+ expect(page).not_to have_content('commit behind the target branch')
+ expect(merge_request.reload).not_to be_merged
+ end
+
+ it 'ignores /merge if /rebase is specified', :sidekiq_inline do
+ fill_in('Description', with: "/merge\n/rebase")
+ click_button('Save changes')
+
+ expect(page).not_to have_content('commit behind the target branch')
+ expect(merge_request.reload).not_to be_merged
+ end
+ end
+
+ context 'when creating a new note' do
+ context 'when the current user can rebase the MR' do
+ before do
+ sign_in(user)
+ visit project_merge_request_path(project, merge_request)
+ end
+
+ it 'rebase the MR', :sidekiq_inline do
+ add_note("/rebase")
+
+ expect(page).to have_content "Scheduled a rebase of branch #{merge_request.source_branch}."
+ end
+ end
+
+ context 'when the current user cannot rebase the MR' do
+ before do
+ project.add_guest(guest)
+ sign_in(guest)
+ visit project_merge_request_path(project, merge_request)
+ end
+
+ it 'does not rebase the MR' do
+ add_note("/rebase")
+
+ expect(page).not_to have_content 'Your commands have been executed!'
+ end
+ end
+ end
+end