summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2019-04-09 13:36:28 +0000
committerJames Lopez <james@gitlab.com>2019-04-09 13:36:28 +0000
commit71171bd38988218bfa2c51c52dba694643d25d85 (patch)
treecb12730755cd05429bb169965eb3786f31a943ec /spec/support
parent1898e1bb398062f9948272da7586d9b2361326a0 (diff)
parent8fdfd521b27e6332ee8bd55d5beecea2cbae9ce0 (diff)
downloadgitlab-ce-71171bd38988218bfa2c51c52dba694643d25d85.tar.gz
Merge branch '59570-due-quick-action' into 'master'
Extract due quick action to shared example Closes #59570 See merge request gitlab-org/gitlab-ce!26918
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/quick_actions/issue/due_quick_action_shared_examples.rb40
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