diff options
author | Sean McGivern <sean@gitlab.com> | 2019-04-05 09:29:10 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-04-05 09:29:10 +0000 |
commit | ca72809cb0760a4498131dbf040c0977a8a5fd35 (patch) | |
tree | 956b6323665db633133b53ccb1a836df2d32d01b /spec | |
parent | 9bee979872bbdfb9930cc31ff7caed698acb3b58 (diff) | |
parent | 08e2bc390f438dc5cd28d40651e369f85b95cbc1 (diff) | |
download | gitlab-ce-ca72809cb0760a4498131dbf040c0977a8a5fd35.tar.gz |
Merge branch '59570-remove-due-date-quick-action' into 'master'
Extract remove due date spec to shared example
Closes #59570
See merge request gitlab-org/gitlab-ce!26922
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/issues/user_uses_quick_actions_spec.rb | 21 | ||||
-rw-r--r-- | spec/support/shared_examples/quick_actions/issue/remove_due_date_quick_action_shared_examples.rb | 40 |
2 files changed, 27 insertions, 34 deletions
diff --git a/spec/features/issues/user_uses_quick_actions_spec.rb b/spec/features/issues/user_uses_quick_actions_spec.rb index 426e205b30b..6a8b5e76cda 100644 --- a/spec/features/issues/user_uses_quick_actions_spec.rb +++ b/spec/features/issues/user_uses_quick_actions_spec.rb @@ -43,7 +43,7 @@ describe 'Issues > User uses quick actions', :js do describe 'issue-only commands' do let(:user) { create(:user) } let(:project) { create(:project, :public) } - let(:issue) { create(:issue, project: project) } + let(:issue) { create(:issue, project: project, due_date: Date.new(2016, 8, 28)) } before do project.add_maintainer(user) @@ -57,6 +57,7 @@ describe 'Issues > User uses quick actions', :js do end it_behaves_like 'confidential quick action' + it_behaves_like 'remove_due_date quick action' describe 'adding a due date from note' do let(:issue) { create(:issue, project: project) } @@ -76,24 +77,6 @@ describe 'Issues > User uses quick actions', :js do end end - describe 'removing a due date from note' do - let(:issue) { create(:issue, project: project, due_date: Date.new(2016, 8, 28)) } - - it_behaves_like 'remove_due_date action available and due date can be removed' - - context 'when the current user cannot update the due date' 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_behaves_like 'remove_due_date action not available' - end - end - describe 'toggling the WIP prefix from the title from note' do let(:issue) { create(:issue, project: project) } 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 |