Commit bf852074 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 03257247 435c492b
......@@ -58,6 +58,7 @@ describe 'Issues > User uses quick actions', :js do
it_behaves_like 'confidential quick action'
it_behaves_like 'remove_due_date quick action'
it_behaves_like 'duplicate quick action'
describe 'adding a due date from note' do
let(:issue) { create(:issue, project: project) }
......
......@@ -58,52 +58,6 @@ describe 'Merge request > User uses quick actions', :js do
it_behaves_like 'merge quick action'
it_behaves_like 'target_branch quick action'
describe 'toggling the WIP prefix in the title from note' do
context 'when the current user can toggle the WIP prefix' do
before do
sign_in(user)
visit project_merge_request_path(project, merge_request)
wait_for_requests
end
it 'adds the WIP: prefix to the title' do
add_note("/wip")
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
expect(merge_request.reload.work_in_progress?).to eq true
end
it 'removes the WIP: prefix from the title' do
merge_request.title = merge_request.wip_title
merge_request.save
add_note("/wip")
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
expect(merge_request.reload.work_in_progress?).to eq false
end
end
context 'when the current user cannot toggle the WIP prefix' do
before do
project.add_guest(guest)
sign_in(guest)
visit project_merge_request_path(project, merge_request)
end
it 'does not change the WIP prefix' do
add_note("/wip")
expect(page).not_to have_content '/wip'
expect(page).not_to have_content 'Commands applied'
expect(merge_request.reload.work_in_progress?).to eq false
end
end
end
it_behaves_like 'wip quick action'
end
end
# frozen_string_literal: true
shared_examples 'duplicate quick action' do
context 'mark issue as duplicate' do
let(:original_issue) { create(:issue, project: project) }
context 'when the current user can update issues' do
it 'does not create a note, and marks the issue as a duplicate' do
add_note("/duplicate ##{original_issue.to_reference}")
expect(page).not_to have_content "/duplicate #{original_issue.to_reference}"
expect(page).to have_content 'Commands applied'
expect(page).to have_content "marked this issue as a duplicate of #{original_issue.to_reference}"
expect(issue.reload).to be_closed
end
end
context 'when the current user cannot update the issue' 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 create a note, and does not mark the issue as a duplicate' do
add_note("/duplicate ##{original_issue.to_reference}")
expect(page).not_to have_content 'Commands applied'
expect(page).not_to have_content "marked this issue as a duplicate of #{original_issue.to_reference}"
expect(issue.reload).to be_open
end
end
end
end
# frozen_string_literal: true
shared_examples 'wip quick action' do
context 'when the current user can toggle the WIP prefix' do
before do
sign_in(user)
visit project_merge_request_path(project, merge_request)
wait_for_requests
end
it 'adds the WIP: prefix to the title' do
add_note('/wip')
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
expect(merge_request.reload.work_in_progress?).to eq true
end
it 'removes the WIP: prefix from the title' do
merge_request.update!(title: merge_request.wip_title)
add_note('/wip')
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
expect(merge_request.reload.work_in_progress?).to eq false
end
end
context 'when the current user cannot toggle the WIP prefix' do
before do
project.add_guest(guest)
sign_in(guest)
visit project_merge_request_path(project, merge_request)
end
it 'does not change the WIP prefix' do
add_note('/wip')
expect(page).not_to have_content '/wip'
expect(page).not_to have_content 'Commands applied'
expect(merge_request.reload.work_in_progress?).to eq false
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