Make merge requests bulk update working
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
f28ca293b7
commit
af9dc9736e
4 changed files with 121 additions and 1 deletions
|
@ -111,4 +111,12 @@ module IssuablesHelper
|
|||
issuable.open? ? :opened : :closed
|
||||
end
|
||||
end
|
||||
|
||||
def issuable_bulk_update_path(type)
|
||||
if type == "issue"
|
||||
bulk_update_namespace_project_issues_path(@project.namespace, @project)
|
||||
else
|
||||
bulk_update_namespace_project_merge_requests_path(@project.namespace, @project)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
- if @bulk_edit
|
||||
.issues_bulk_update.hide
|
||||
= form_tag bulk_update_namespace_project_issues_path(@project.namespace, @project), method: :post, class: 'bulk-update' do
|
||||
= form_tag issuable_bulk_update_path(type), method: :post, class: 'bulk-update' do
|
||||
.filter-item.inline
|
||||
= dropdown_tag("Status", options: { toggle_class: "js-issue-status", title: "Change status", dropdown_class: "dropdown-menu-status dropdown-menu-selectable", data: { field_name: "update[state_event]" } } ) do
|
||||
%ul
|
||||
|
|
|
@ -747,6 +747,7 @@ Rails.application.routes.draw do
|
|||
get :branch_to
|
||||
get :update_branches
|
||||
get :diff_for_path
|
||||
post :bulk_update
|
||||
end
|
||||
|
||||
resources :discussions, only: [], constraints: { id: /\h{40}/ } do
|
||||
|
|
111
spec/features/merge_requests/update_merge_requests_spec.rb
Normal file
111
spec/features/merge_requests/update_merge_requests_spec.rb
Normal file
|
@ -0,0 +1,111 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Multiple merge requests updating from merge_requests#index', feature: true do
|
||||
include WaitForAjax
|
||||
|
||||
let!(:user) { create(:user)}
|
||||
let!(:project) { create(:project) }
|
||||
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
|
||||
|
||||
before do
|
||||
project.team << [user, :master]
|
||||
login_as(user)
|
||||
end
|
||||
|
||||
context 'status', js: true do
|
||||
it 'sets to closed' do
|
||||
visit namespace_project_merge_requests_path(project.namespace, project)
|
||||
|
||||
find('#check_all_issues').click
|
||||
find('.js-issue-status').click
|
||||
|
||||
find('.dropdown-menu-status a', text: 'Closed').click
|
||||
click_update_merge_requests_button
|
||||
expect(page).to have_selector('.merge-request', count: 0)
|
||||
end
|
||||
|
||||
it 'sets to open' do
|
||||
merge_request.close
|
||||
visit namespace_project_merge_requests_path(project.namespace, project, state: 'closed')
|
||||
|
||||
find('#check_all_issues').click
|
||||
find('.js-issue-status').click
|
||||
|
||||
find('.dropdown-menu-status a', text: 'Open').click
|
||||
click_update_merge_requests_button
|
||||
expect(page).to have_selector('.merge-request', count: 0)
|
||||
end
|
||||
end
|
||||
|
||||
context 'assignee', js: true do
|
||||
it 'updates to current user' do
|
||||
visit namespace_project_merge_requests_path(project.namespace, project)
|
||||
|
||||
find('#check_all_issues').click
|
||||
click_update_assignee_button
|
||||
|
||||
find('.dropdown-menu-user-link', text: user.username).click
|
||||
click_update_merge_requests_button
|
||||
|
||||
page.within('.merge-request .controls') do
|
||||
expect(find('.author_link')["title"]).to have_content(user.name)
|
||||
end
|
||||
end
|
||||
|
||||
it 'updates to unassigned' do
|
||||
merge_request.assignee = user
|
||||
merge_request.save
|
||||
visit namespace_project_merge_requests_path(project.namespace, project)
|
||||
|
||||
find('#check_all_issues').click
|
||||
click_update_assignee_button
|
||||
|
||||
click_link 'Unassigned'
|
||||
click_update_merge_requests_button
|
||||
expect(find('.merge-request:first-child .controls')).not_to have_css('.author_link')
|
||||
end
|
||||
end
|
||||
|
||||
context 'milestone', js: true do
|
||||
let(:milestone) { create(:milestone, project: project) }
|
||||
|
||||
it 'updates milestone' do
|
||||
visit namespace_project_merge_requests_path(project.namespace, project)
|
||||
|
||||
find('#check_all_issues').click
|
||||
find('.issues_bulk_update .js-milestone-select').click
|
||||
|
||||
find('.dropdown-menu-milestone a', text: milestone.title).click
|
||||
click_update_merge_requests_button
|
||||
|
||||
expect(find('.merge-request')).to have_content milestone.title
|
||||
end
|
||||
|
||||
it 'sets to no milestone' do
|
||||
merge_request.milestone = milestone
|
||||
merge_request.save
|
||||
|
||||
visit namespace_project_merge_requests_path(project.namespace, project)
|
||||
|
||||
expect(first('.merge-request')).to have_content milestone.title
|
||||
|
||||
find('#check_all_issues').click
|
||||
find('.issues_bulk_update .js-milestone-select').click
|
||||
|
||||
find('.dropdown-menu-milestone a', text: "No Milestone").click
|
||||
click_update_merge_requests_button
|
||||
|
||||
expect(find('.merge-request:first-child')).not_to have_content milestone.title
|
||||
end
|
||||
end
|
||||
|
||||
def click_update_assignee_button
|
||||
find('.js-update-assignee').click
|
||||
wait_for_ajax
|
||||
end
|
||||
|
||||
def click_update_merge_requests_button
|
||||
find('.update_selected_issues').click
|
||||
wait_for_ajax
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue