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