diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-25 09:30:15 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-25 09:30:15 +0000 |
commit | d5801545ec25780402c30c4d30d4efa16f0728a4 (patch) | |
tree | 4c9bd2755246f16dfa9e46d07cd4eae298bcf277 /spec/features/issues | |
parent | d95e6da0d582cd4b0d333b3b6a1bfa3a565b874e (diff) | |
parent | 1df696f5a6836e03a6bf8d5139c2c7ce6d96e727 (diff) | |
download | gitlab-ce-d5801545ec25780402c30c4d30d4efa16f0728a4.tar.gz |
Merge branch 'archytaus/gitlab-ce-26372-duplicate-issue-slash-command' into 'master'
New `/duplicate` quick action
Closes #26372
See merge request !12845
Diffstat (limited to 'spec/features/issues')
-rw-r--r-- | spec/features/issues/user_uses_slash_commands_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/features/issues/user_uses_slash_commands_spec.rb b/spec/features/issues/user_uses_slash_commands_spec.rb index 4740402dc01..0c3c27e3e45 100644 --- a/spec/features/issues/user_uses_slash_commands_spec.rb +++ b/spec/features/issues/user_uses_slash_commands_spec.rb @@ -118,5 +118,42 @@ feature 'Issues > User uses quick actions', feature: true, js: true do expect(page).not_to have_content '/wip' end end + + describe 'mark issue as duplicate' do + let(:issue) { create(:issue, project: project) } + let(:original_issue) { create(:issue, project: project) } + + context 'when the current user can update issues' do + it 'does not create a note, and marks the issue as a duplicate' do + write_note("/duplicate ##{original_issue.to_reference}") + + expect(page).not_to have_content "/duplicate #{original_issue.to_reference}" + expect(page).to have_content 'Commands applied' + expect(page).to have_content "marked this issue as a duplicate of #{original_issue.to_reference}" + + expect(issue.reload).to be_closed + end + end + + context 'when the current user cannot update the issue' do + let(:guest) { create(:user) } + before do + project.team << [guest, :guest] + gitlab_sign_out + sign_in(guest) + visit project_issue_path(project, issue) + end + + it 'does not create a note, and does not mark the issue as a duplicate' do + write_note("/duplicate ##{original_issue.to_reference}") + + expect(page).to have_content "/duplicate ##{original_issue.to_reference}" + expect(page).not_to have_content 'Commands applied' + expect(page).not_to have_content "marked this issue as a duplicate of #{original_issue.to_reference}" + + expect(issue.reload).to be_open + end + end + end end end |