2016-06-02 11:05:42 +05:30
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
feature 'Multiple issue updating from issues#index', feature: true do
|
2016-06-16 23:09:34 +05:30
|
|
|
include WaitForAjax
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
let!(:project) { create(:project) }
|
|
|
|
let!(:issue) { create(:issue, project: project) }
|
|
|
|
let!(:user) { create(:user)}
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
login_as(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'status', js: true do
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'sets to closed' do
|
2016-06-02 11:05:42 +05:30
|
|
|
visit namespace_project_issues_path(project.namespace, project)
|
|
|
|
|
|
|
|
find('#check_all_issues').click
|
|
|
|
find('.js-issue-status').click
|
|
|
|
|
|
|
|
find('.dropdown-menu-status a', text: 'Closed').click
|
|
|
|
click_update_issues_button
|
|
|
|
expect(page).to have_selector('.issue', count: 0)
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'sets to open' do
|
2016-06-02 11:05:42 +05:30
|
|
|
create_closed
|
2016-06-16 23:09:34 +05:30
|
|
|
visit namespace_project_issues_path(project.namespace, project, state: 'closed')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
find('#check_all_issues').click
|
|
|
|
find('.js-issue-status').click
|
|
|
|
|
|
|
|
find('.dropdown-menu-status a', text: 'Open').click
|
|
|
|
click_update_issues_button
|
|
|
|
expect(page).to have_selector('.issue', count: 0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'assignee', js: true do
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'updates to current user' do
|
2016-06-02 11:05:42 +05:30
|
|
|
visit namespace_project_issues_path(project.namespace, project)
|
|
|
|
|
|
|
|
find('#check_all_issues').click
|
2016-06-16 23:09:34 +05:30
|
|
|
click_update_assignee_button
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
find('.dropdown-menu-user-link', text: user.username).click
|
|
|
|
click_update_issues_button
|
|
|
|
|
|
|
|
page.within('.issue .controls') do
|
|
|
|
expect(find('.author_link')["title"]).to have_content(user.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'updates to unassigned' do
|
2016-06-02 11:05:42 +05:30
|
|
|
create_assigned
|
|
|
|
visit namespace_project_issues_path(project.namespace, project)
|
|
|
|
|
|
|
|
find('#check_all_issues').click
|
2016-06-16 23:09:34 +05:30
|
|
|
click_update_assignee_button
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
click_link 'Unassigned'
|
|
|
|
click_update_issues_button
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(find('.issue:first-child .controls')).not_to have_css('.author_link')
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'milestone', js: true do
|
|
|
|
let(:milestone) { create(:milestone, project: project) }
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'updates milestone' do
|
2016-06-02 11:05:42 +05:30
|
|
|
visit namespace_project_issues_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_issues_button
|
|
|
|
|
|
|
|
expect(find('.issue')).to have_content milestone.title
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'sets to no milestone' do
|
2016-06-02 11:05:42 +05:30
|
|
|
create_with_milestone
|
|
|
|
visit namespace_project_issues_path(project.namespace, project)
|
|
|
|
|
|
|
|
expect(first('.issue')).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_issues_button
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(find('.issue:first-child')).not_to have_content milestone.title
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_closed
|
|
|
|
create(:issue, project: project, state: :closed)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_assigned
|
|
|
|
create(:issue, project: project, assignee: user)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_with_milestone
|
|
|
|
create(:issue, project: project, milestone: milestone)
|
|
|
|
end
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
def click_update_assignee_button
|
|
|
|
find('.js-update-assignee').click
|
|
|
|
wait_for_ajax
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
def click_update_issues_button
|
|
|
|
find('.update_selected_issues').click
|
2016-06-16 23:09:34 +05:30
|
|
|
wait_for_ajax
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|