2016-09-07 06:54:39 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
feature 'Multiple merge requests updating from merge_requests#index' do
|
2016-09-07 06:54:39 -04:00
|
|
|
let!(:user) { create(:user)}
|
2017-07-26 17:52:10 -04:00
|
|
|
let!(:project) { create(:project, :repository) }
|
2016-09-07 06:54:39 -04:00
|
|
|
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'status', js: true do
|
2016-09-08 08:33:53 -04:00
|
|
|
describe 'close merge request' do
|
|
|
|
before do
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_requests_path(project)
|
2016-09-08 08:33:53 -04:00
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
it 'closes merge request' do
|
|
|
|
change_status('Closed')
|
|
|
|
|
|
|
|
expect(page).to have_selector('.merge-request', count: 0)
|
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
describe 'reopen merge request' do
|
|
|
|
before do
|
|
|
|
merge_request.close
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_requests_path(project, state: 'closed')
|
2016-09-08 08:33:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'reopens merge request' do
|
|
|
|
change_status('Open')
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
expect(page).to have_selector('.merge-request', count: 0)
|
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'assignee', js: true do
|
2016-09-08 08:33:53 -04:00
|
|
|
describe 'set assignee' do
|
2016-09-08 04:46:04 -04:00
|
|
|
before do
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_requests_path(project)
|
2016-09-08 04:46:04 -04:00
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
it "updates merge request with assignee" do
|
2016-09-08 04:46:04 -04:00
|
|
|
change_assignee(user.name)
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
page.within('.merge-request .controls') do
|
|
|
|
expect(find('.author_link')["title"]).to have_content(user.name)
|
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
describe 'remove assignee' do
|
2016-09-08 04:46:04 -04:00
|
|
|
before do
|
|
|
|
merge_request.assignee = user
|
|
|
|
merge_request.save
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_requests_path(project)
|
2016-09-08 04:46:04 -04:00
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
it "removes assignee from the merge request" do
|
2016-09-08 04:46:04 -04:00
|
|
|
change_assignee('Unassigned')
|
2016-09-08 08:33:53 -04:00
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
expect(find('.merge-request .controls')).not_to have_css('.author_link')
|
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'milestone', js: true do
|
|
|
|
let(:milestone) { create(:milestone, project: project) }
|
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
describe 'set milestone' do
|
2016-09-08 04:46:04 -04:00
|
|
|
before do
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_requests_path(project)
|
2016-09-08 04:46:04 -04:00
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
it "updates merge request with milestone" do
|
2016-09-08 04:46:04 -04:00
|
|
|
change_milestone(milestone.title)
|
2016-09-08 08:33:53 -04:00
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
expect(find('.merge-request')).to have_content milestone.title
|
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
describe 'unset milestone' do
|
2016-09-08 04:46:04 -04:00
|
|
|
before do
|
|
|
|
merge_request.milestone = milestone
|
|
|
|
merge_request.save
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_requests_path(project)
|
2016-09-08 04:46:04 -04:00
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 08:33:53 -04:00
|
|
|
it "removes milestone from the merge request" do
|
2016-09-08 04:46:04 -04:00
|
|
|
change_milestone("No Milestone")
|
2016-09-08 08:33:53 -04:00
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
expect(find('.merge-request')).not_to have_content milestone.title
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
def change_status(text)
|
2017-05-15 18:12:43 -04:00
|
|
|
click_button 'Edit Merge Requests'
|
|
|
|
find('#check-all-issues').click
|
2016-09-08 04:46:04 -04:00
|
|
|
find('.js-issue-status').click
|
|
|
|
find('.dropdown-menu-status a', text: text).click
|
|
|
|
click_update_merge_requests_button
|
|
|
|
end
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
def change_assignee(text)
|
2017-05-15 18:12:43 -04:00
|
|
|
click_button 'Edit Merge Requests'
|
|
|
|
find('#check-all-issues').click
|
2016-09-08 04:46:04 -04:00
|
|
|
find('.js-update-assignee').click
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2016-09-07 06:54:39 -04:00
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
page.within '.dropdown-menu-user' do
|
|
|
|
click_link text
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
2016-09-08 04:46:04 -04:00
|
|
|
|
|
|
|
click_update_merge_requests_button
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
|
2016-09-08 04:46:04 -04:00
|
|
|
def change_milestone(text)
|
2017-05-15 18:12:43 -04:00
|
|
|
click_button 'Edit Merge Requests'
|
|
|
|
find('#check-all-issues').click
|
|
|
|
find('.issues-bulk-update .js-milestone-select').click
|
2016-09-08 04:46:04 -04:00
|
|
|
find('.dropdown-menu-milestone a', text: text).click
|
|
|
|
click_update_merge_requests_button
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def click_update_merge_requests_button
|
2017-05-15 18:12:43 -04:00
|
|
|
find('.update-selected-issues').click
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2016-09-07 06:54:39 -04:00
|
|
|
end
|
|
|
|
end
|