diff options
author | Alexandru Croitor <acroitor@gitlab.com> | 2019-04-03 14:23:58 +0300 |
---|---|---|
committer | Alexandru Croitor <acroitor@gitlab.com> | 2019-04-08 13:22:20 +0300 |
commit | 8fdfd521b27e6332ee8bd55d5beecea2cbae9ce0 (patch) | |
tree | f0ee510b8fd1e42a119b3945d9b7ba997844d6ba /spec/support/shared_examples | |
parent | 6844ba2dcc14c722c149f8b257c7fe73ba4854f4 (diff) | |
download | gitlab-ce-8fdfd521b27e6332ee8bd55d5beecea2cbae9ce0.tar.gz |
Extract due quick action to shared example59570-due-quick-action
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/quick_actions/issue/due_quick_action_shared_examples.rb | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/spec/support/shared_examples/quick_actions/issue/due_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/due_quick_action_shared_examples.rb index db3ecccc339..ae78cd86cd5 100644 --- a/spec/support/shared_examples/quick_actions/issue/due_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issue/due_quick_action_shared_examples.rb @@ -1,25 +1,35 @@ # frozen_string_literal: true -shared_examples 'due quick action not available' do - it 'does not set the due date' do - add_note('/due 2016-08-28') +shared_examples 'due quick action' do + context 'due quick action available and date can be added' do + it 'sets the due date accordingly' do + add_note('/due 2016-08-28') - expect(page).not_to have_content 'Commands applied' - expect(page).not_to have_content '/due 2016-08-28' - end -end + expect(page).not_to have_content '/due 2016-08-28' + expect(page).to have_content 'Commands applied' + + visit project_issue_path(project, issue) -shared_examples 'due quick action available and date can be added' do - it 'sets the due date accordingly' do - add_note('/due 2016-08-28') + page.within '.due_date' do + expect(page).to have_content 'Aug 28, 2016' + end + end + end - expect(page).not_to have_content '/due 2016-08-28' - expect(page).to have_content 'Commands applied' + context 'due quick action not available' do + let(:guest) { create(:user) } + before do + project.add_guest(guest) + gitlab_sign_out + sign_in(guest) + visit project_issue_path(project, issue) + end - visit project_issue_path(project, issue) + it 'does not set the due date' do + add_note('/due 2016-08-28') - page.within '.due_date' do - expect(page).to have_content 'Aug 28, 2016' + expect(page).not_to have_content 'Commands applied' + expect(page).not_to have_content '/due 2016-08-28' end end end |