summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-01-17 16:10:43 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-01-17 16:10:43 +0000
commit25709853cb934a66d9ca363179b39e3dd8e0c13e (patch)
treecb982fa59304aa9346a7f44c335df91413ce2692 /spec/features
parent16b1512e2271ceec4c9375ecb861b12d0dc82aaa (diff)
parent557a0bf14c79c02c65196ff8f7a2251ecd77073c (diff)
downloadgitlab-ce-25709853cb934a66d9ca363179b39e3dd8e0c13e.tar.gz
Merge branch '24915_merge_slash_command' into 'master'
Support `/merge` slash command for MRs Closes #24915 See merge request !7746
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/merge_requests/user_uses_slash_commands_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/features/merge_requests/user_uses_slash_commands_spec.rb b/spec/features/merge_requests/user_uses_slash_commands_spec.rb
index b1b3a47a1ce..b13674b4db9 100644
--- a/spec/features/merge_requests/user_uses_slash_commands_spec.rb
+++ b/spec/features/merge_requests/user_uses_slash_commands_spec.rb
@@ -68,6 +68,51 @@ feature 'Merge Requests > User uses slash commands', feature: true, js: true do
end
end
+ describe 'merging the MR from the note' do
+ context 'when the current user can merge the MR' do
+ it 'merges the MR' do
+ write_note("/merge")
+
+ expect(page).to have_content 'Commands applied'
+
+ expect(merge_request.reload).to be_merged
+ end
+ end
+
+ context 'when the head diff changes in the meanwhile' do
+ before do
+ merge_request.source_branch = 'another_branch'
+ merge_request.save
+ end
+
+ it 'does not merge the MR' do
+ write_note("/merge")
+
+ expect(page).not_to have_content 'Your commands have been executed!'
+
+ expect(merge_request.reload).not_to be_merged
+ end
+ end
+
+ context 'when the current user cannot merge the MR' do
+ let(:guest) { create(:user) }
+ before do
+ project.team << [guest, :guest]
+ logout
+ login_with(guest)
+ visit namespace_project_merge_request_path(project.namespace, project, merge_request)
+ end
+
+ it 'does not merge the MR' do
+ write_note("/merge")
+
+ expect(page).not_to have_content 'Your commands have been executed!'
+
+ expect(merge_request.reload).not_to be_merged
+ end
+ end
+ end
+
describe 'adding a due date from note' do
it 'does not recognize the command nor create a note' do
write_note('/due 2016-08-28')