diff options
author | Sean McGivern <sean@gitlab.com> | 2019-04-08 10:43:51 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-04-08 10:43:51 +0300 |
commit | ddf3edc7a956dbf54115fd141c81b4b2f7a655b4 (patch) | |
tree | d9810bc18c7137715d3f86a028ff28ff8131fdee /spec | |
parent | 26658d139b449b256980b25c34aa0f1492152e47 (diff) | |
parent | 5b64beca82b17d37e5ab2206175c06242ae5ac27 (diff) |
Merge branch '59570-duplicate-quick-action' into 'master'
Extract duplicate quick action spec to a shared example
Closes #59570
See merge request gitlab-org/gitlab-ce!26912
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/issues/user_uses_quick_actions_spec.rb | 37 | ||||
-rw-r--r-- | spec/support/shared_examples/quick_actions/issue/duplicate_quick_action_shared_examples.rb | 34 |
2 files changed, 35 insertions, 36 deletions
diff --git a/spec/features/issues/user_uses_quick_actions_spec.rb b/spec/features/issues/user_uses_quick_actions_spec.rb index 6a8b5e76cda..9938a4e781c 100644 --- a/spec/features/issues/user_uses_quick_actions_spec.rb +++ b/spec/features/issues/user_uses_quick_actions_spec.rb @@ -58,6 +58,7 @@ describe 'Issues > User uses quick actions', :js do it_behaves_like 'confidential quick action' it_behaves_like 'remove_due_date quick action' + it_behaves_like 'duplicate quick action' describe 'adding a due date from note' do let(:issue) { create(:issue, project: project) } @@ -87,42 +88,6 @@ describe 'Issues > User uses quick actions', :js do 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 - add_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.add_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 - add_note("/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 - describe 'move the issue to another project' do let(:issue) { create(:issue, project: project) } diff --git a/spec/support/shared_examples/quick_actions/issue/duplicate_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/duplicate_quick_action_shared_examples.rb index 24576fe0021..633c7135fbc 100644 --- a/spec/support/shared_examples/quick_actions/issue/duplicate_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issue/duplicate_quick_action_shared_examples.rb @@ -1,4 +1,38 @@ # frozen_string_literal: true shared_examples 'duplicate quick action' do + context 'mark issue as duplicate' do + 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 + add_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.add_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 + add_note("/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 |