diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-15 21:12:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-15 21:12:21 +0300 |
commit | 4481a56a94c579f52e1cdef1cc1f4995f0ee1412 (patch) | |
tree | 9b8d431d53057e6351dd56718d212b2c89b19312 /spec/support | |
parent | e5c7d631a84940c66e46f1824ba7ce0c7f1d0ea4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/quick_actions/issue/promote_to_incident_quick_action_shared_examples.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/support/shared_examples/quick_actions/issue/promote_to_incident_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/promote_to_incident_quick_action_shared_examples.rb new file mode 100644 index 00000000000..5167d27f8b9 --- /dev/null +++ b/spec/support/shared_examples/quick_actions/issue/promote_to_incident_quick_action_shared_examples.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'promote_to_incident quick action' do + describe '/promote_to_incident' do + context 'when issue can be promoted' do + it 'promotes issue to incident' do + add_note('/promote_to_incident') + + expect(issue.reload.issue_type).to eq('incident') + expect(page).to have_content('Issue has been promoted to incident') + end + end + + context 'when issue is already an incident' do + let(:issue) { create(:incident, project: project) } + + it 'does not promote the issue' do + add_note('/promote_to_incident') + + expect(page).to have_content('Could not apply promote_to_incident command') + end + end + + context 'when user does not have permissions' do + let(:guest) { create(:user) } + + before do + sign_in(guest) + visit project_issue_path(project, issue) + wait_for_all_requests + end + + it 'does not promote the issue' do + add_note('/promote_to_incident') + + expect(page).to have_content('Could not apply promote_to_incident command') + end + end + end +end |