summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb
diff options
context:
space:
mode:
authorAlexandru Croitor <acroitor@gitlab.com>2019-04-03 14:41:49 +0300
committerAlexandru Croitor <acroitor@gitlab.com>2019-04-05 00:25:34 +0300
commit08e2bc390f438dc5cd28d40651e369f85b95cbc1 (patch)
tree04200801e58543162d9755b4ac91d5806dbb44f3 /spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb
parent1ddd9eff6dd931b0689743d571b7bf3fccedb979 (diff)
downloadgitlab-ce-59570-remove-due-date-quick-action.tar.gz
Extract remove due date spec to shared example59570-remove-due-date-quick-action
Diffstat (limited to 'spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb40
1 files changed, 25 insertions, 15 deletions
diff --git a/spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb
index 5904164fcfc..dd1676a08e2 100644
--- a/spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb
+++ b/spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb
@@ -1,25 +1,35 @@
# frozen_string_literal: true
-shared_examples 'remove_due_date action not available' do
- it 'does not remove the due date' do
- add_note("/remove_due_date")
+shared_examples 'remove_due_date quick action' do
+ context 'remove_due_date action available and due date can be removed' do
+ it 'removes the due date accordingly' do
+ add_note('/remove_due_date')
- expect(page).not_to have_content 'Commands applied'
- expect(page).not_to have_content '/remove_due_date'
- end
-end
+ expect(page).not_to have_content '/remove_due_date'
+ expect(page).to have_content 'Commands applied'
+
+ visit project_issue_path(project, issue)
-shared_examples 'remove_due_date action available and due date can be removed' do
- it 'removes the due date accordingly' do
- add_note('/remove_due_date')
+ page.within '.due_date' do
+ expect(page).to have_content 'No due date'
+ end
+ end
+ end
- expect(page).not_to have_content '/remove_due_date'
- expect(page).to have_content 'Commands applied'
+ context 'remove_due_date 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 remove the due date' do
+ add_note("/remove_due_date")
- page.within '.due_date' do
- expect(page).to have_content 'No due date'
+ expect(page).not_to have_content 'Commands applied'
+ expect(page).not_to have_content '/remove_due_date'
end
end
end