Commit 71171bd3 authored by James Lopez's avatar James Lopez

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
parents 1898e1bb 8fdfd521
...@@ -60,34 +60,7 @@ describe 'Issues > User uses quick actions', :js do ...@@ -60,34 +60,7 @@ describe 'Issues > User uses quick actions', :js do
it_behaves_like 'remove_due_date quick action' it_behaves_like 'remove_due_date quick action'
it_behaves_like 'duplicate quick action' it_behaves_like 'duplicate quick action'
it_behaves_like 'create_merge_request quick action' it_behaves_like 'create_merge_request quick action'
it_behaves_like 'due quick action'
describe 'adding a due date from note' do
let(:issue) { create(:issue, project: project) }
it_behaves_like 'due quick action available and date can be added'
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 'due quick action not available'
end
end
describe 'toggling the WIP prefix from the title from note' do
let(:issue) { create(:issue, project: project) }
it 'does not recognize the command nor create a note' do
add_note("/wip")
expect(page).not_to have_content '/wip'
end
end
describe 'move the issue to another project' do describe 'move the issue to another project' do
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
......
# frozen_string_literal: true # frozen_string_literal: true
shared_examples 'due quick action not available' do shared_examples 'due quick action' do
it 'does not set the due date' do context 'due quick action available and date can be added' 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
shared_examples 'due quick action available and date can be added' do
it 'sets the due date accordingly' do it 'sets the due date accordingly' do
add_note('/due 2016-08-28') add_note('/due 2016-08-28')
...@@ -22,4 +14,22 @@ shared_examples 'due quick action available and date can be added' do ...@@ -22,4 +14,22 @@ shared_examples 'due quick action available and date can be added' do
expect(page).to have_content 'Aug 28, 2016' expect(page).to have_content 'Aug 28, 2016'
end end
end end
end
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
it 'does not set the due date' 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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment