diff options
author | Ryan Scott <ryan@ryan-scott.me> | 2017-03-30 04:39:06 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-07-20 17:33:24 +0300 |
commit | 01c9488f4a559063eba77074ba2d369de87b8018 (patch) | |
tree | ffd18d3ebd174cf47ab9eb71cbacd940d4cf2831 /spec/features | |
parent | b6555693a8e445405c5746b7c76c9f603395bba2 (diff) |
Added slash command to close an issue as a duplicate. Closes #26372
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/issues/user_uses_slash_commands_spec.rb | 41 |
1 files changed, 41 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 1cd1f016674..d5de060b033 100644 --- a/spec/features/issues/user_uses_slash_commands_spec.rb +++ b/spec/features/issues/user_uses_slash_commands_spec.rb @@ -134,5 +134,46 @@ 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}" + + issue.reload + + expect(issue.closed?).to be_truthy + end + end + + context 'when the current user cannot update the issue' do + let(:guest) { create(:user) } + before do + project.team << [guest, :guest] + logout + login_with(guest) + visit namespace_project_issue_path(project.namespace, 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}" + + issue.reload + + expect(issue.closed?).to be_falsey + end + end + end end end |