diff options
author | Alexandru Croitor <acroitor@gitlab.com> | 2019-04-03 13:34:26 +0300 |
---|---|---|
committer | Alexandru Croitor <acroitor@gitlab.com> | 2019-04-04 15:40:49 +0300 |
commit | 8bf88876b8198af71bcfa20ae7038b6a6063e406 (patch) | |
tree | 11beea7479f25f282d4c2b9d1411844f496c05b6 /spec/support/shared_examples/quick_actions | |
parent | c60d0efe0d2f2f0bdd1e626c378fe655461c5f22 (diff) |
Extract confidential quick action spec to a shared example
Diffstat (limited to 'spec/support/shared_examples/quick_actions')
-rw-r--r-- | spec/support/shared_examples/quick_actions/issue/confidential_quick_action_shared_examples.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/support/shared_examples/quick_actions/issue/confidential_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/confidential_quick_action_shared_examples.rb index c68e5aee842..336500487fe 100644 --- a/spec/support/shared_examples/quick_actions/issue/confidential_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issue/confidential_quick_action_shared_examples.rb @@ -1,4 +1,35 @@ # frozen_string_literal: true shared_examples 'confidential quick action' do + context 'when the current user can update issues' do + it 'does not create a note, and marks the issue as confidential' do + add_note('/confidential') + + expect(page).not_to have_content '/confidential' + expect(page).to have_content 'Commands applied' + expect(page).to have_content 'made the issue confidential' + + expect(issue.reload).to be_confidential + 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 confidential' do + add_note('/confidential') + + expect(page).not_to have_content 'Commands applied' + expect(page).not_to have_content 'made the issue confidential' + + expect(issue.reload).not_to be_confidential + end + end end |