2016-06-30 11:34:19 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-05-31 01:50:53 -04:00
|
|
|
feature 'Issues > User uses quick actions', feature: true, js: true do
|
|
|
|
include QuickActionsHelpers
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2017-05-31 01:50:53 -04:00
|
|
|
it_behaves_like 'issuable record that supports quick actions in its description and notes', :issue do
|
2016-06-30 11:34:19 -04:00
|
|
|
let(:issuable) { create(:issue, project: project) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'issue-only commands' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
|
|
|
|
2016-09-08 18:51:35 -04:00
|
|
|
after do
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2016-09-08 18:51:35 -04:00
|
|
|
end
|
|
|
|
|
2016-06-30 11:34:19 -04:00
|
|
|
describe 'adding a due date from note' do
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
context 'when the current user can update the due date' do
|
|
|
|
it 'does not create a note, and sets the due date accordingly' do
|
|
|
|
write_note("/due 2016-08-28")
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
expect(page).not_to have_content '/due 2016-08-28'
|
2016-12-15 14:54:43 -05:00
|
|
|
expect(page).to have_content 'Commands applied'
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
issue.reload
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
expect(issue.due_date).to eq Date.new(2016, 8, 28)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the current user cannot update the due date' do
|
|
|
|
let(:guest) { create(:user) }
|
|
|
|
before do
|
|
|
|
project.team << [guest, :guest]
|
2017-07-07 16:46:20 -04:00
|
|
|
gitlab_sign_out
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(guest)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-09-27 05:29:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not create a note, and sets the due date accordingly' do
|
|
|
|
write_note("/due 2016-08-28")
|
|
|
|
|
|
|
|
expect(page).to have_content '/due 2016-08-28'
|
2016-12-15 14:54:43 -05:00
|
|
|
expect(page).not_to have_content 'Commands applied'
|
2016-09-27 05:29:06 -04:00
|
|
|
|
|
|
|
issue.reload
|
|
|
|
|
|
|
|
expect(issue.due_date).to be_nil
|
|
|
|
end
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'removing a due date from note' do
|
|
|
|
let(:issue) { create(:issue, project: project, due_date: Date.new(2016, 8, 28)) }
|
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
context 'when the current user can update the due date' do
|
|
|
|
it 'does not create a note, and removes the due date accordingly' do
|
|
|
|
expect(issue.due_date).to eq Date.new(2016, 8, 28)
|
|
|
|
|
|
|
|
write_note("/remove_due_date")
|
|
|
|
|
|
|
|
expect(page).not_to have_content '/remove_due_date'
|
2016-12-15 14:54:43 -05:00
|
|
|
expect(page).to have_content 'Commands applied'
|
2016-09-27 05:29:06 -04:00
|
|
|
|
|
|
|
issue.reload
|
|
|
|
|
|
|
|
expect(issue.due_date).to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the current user cannot update the due date' do
|
|
|
|
let(:guest) { create(:user) }
|
|
|
|
before do
|
|
|
|
project.team << [guest, :guest]
|
2017-07-07 16:46:20 -04:00
|
|
|
gitlab_sign_out
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(guest)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-09-27 05:29:06 -04:00
|
|
|
end
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
it 'does not create a note, and sets the due date accordingly' do
|
|
|
|
write_note("/remove_due_date")
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
expect(page).to have_content '/remove_due_date'
|
2016-12-15 14:54:43 -05:00
|
|
|
expect(page).not_to have_content 'Commands applied'
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
issue.reload
|
2016-06-30 11:34:19 -04:00
|
|
|
|
2016-09-27 05:29:06 -04:00
|
|
|
expect(issue.due_date).to eq Date.new(2016, 8, 28)
|
|
|
|
end
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
|
|
|
end
|
2016-09-08 05:18:41 -04:00
|
|
|
|
2016-12-20 09:44:24 -05:00
|
|
|
describe 'Issuable time tracking' do
|
|
|
|
let(:issue) { create(:issue, project: project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :developer]
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Issue' do
|
|
|
|
before do
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_issue_path(project, issue)
|
2016-12-20 09:44:24 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'issuable time tracker'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Merge Request' do
|
|
|
|
let(:merge_request) { create(:merge_request, source_project: project) }
|
|
|
|
|
|
|
|
before do
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_request_path(project, merge_request)
|
2016-12-20 09:44:24 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'issuable time tracker'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-08 05:18:41 -04:00
|
|
|
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
|
|
|
|
write_note("/wip")
|
|
|
|
|
|
|
|
expect(page).not_to have_content '/wip'
|
|
|
|
end
|
|
|
|
end
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
|
|
|
end
|