diff options
author | Jarka Kadlecova <kadlecovaj@gmail.com> | 2016-11-24 15:05:15 +0100 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-01-11 08:48:07 -0500 |
commit | 7ab3dd4b302a85c1b005e9ef290ebac631cda673 (patch) | |
tree | 9210fbc8f4e53c33970e6218c822de95c8963288 /spec/features | |
parent | 4404ea8662508c60f96e6730d9a45feb68498c28 (diff) | |
download | gitlab-ce-7ab3dd4b302a85c1b005e9ef290ebac631cda673.tar.gz |
support `/merge` slash comand for MRs
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/merge_requests/user_uses_slash_commands_spec.rb | 57 |
1 files changed, 57 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..d7e8723b63a 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,63 @@ 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 'Your commands have been executed!' + + expect(merge_request.reload).to be_merged + end + end + + context 'when the head diff changes in the meanwhile' do + before do + path = File.expand_path("#{project.repository_storage_path}/#{project.namespace.path}/#{project.path}/new_file.txt") + + params = { + source_project: merge_request.project, + target_project: merge_request.project, + target_branch: merge_request.source_branch, + source_branch: merge_request.source_branch, + file_path: path, + file_content: 'some content', + commit_message: 'additional commit', + } + + Files::UpdateService.new(project, user, params).execute + merge_request.reload_diff + 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') |