gitlab-org--gitlab-foss/spec/features/merge_requests/update_merge_requests_spec.rb
Mike Greiling f783798825
Merge branch 'master' into sh-headless-chrome-support
* master: (113 commits)
  Introduce new hook data builders for Issue and MergeRequest
  Don't create todos for old issue assignees
  Start adding Gitlab::HookData::IssuableBuilder
  Include the changes in issuable webhook payloads
  Rename the `codeclimate` job to `codequality`
  Don't show an "Unsubscribe" link in snippet comment notifications
  Add QA::Scenario::Gitlab::Group::Create
  Removes CommitsList from global namespace
  Fix wiki empty page translation namespace not being removed
  Fixes mini graph in commit view
  Fix link to new i18n index page
  Update i18n docs
  Move i18n/introduction to i18n/index
  Resolve "Simple documentation update - backup to restore in restore section"
  Remove AjaxLoadingSpinner and CreateLabelDropdown from global namespace
  Move cycle analytics banner into a vue file
  Updated Icons + Fix for Collapsed Groups Angle
  Don't create fork networks for root projects that are deleted
  Remove executable permissions on images to make docs lint happy
  Sync up hard coded DN class in migration
  ...
2017-10-09 15:00:00 -05:00

133 lines
3.3 KiB
Ruby

require 'rails_helper'
feature 'Multiple merge requests updating from merge_requests#index' do
let!(:user) { create(:user)}
let!(:project) { create(:project, :repository) }
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
before do
project.team << [user, :master]
sign_in(user)
end
context 'status', :js do
describe 'close merge request' do
before do
visit project_merge_requests_path(project)
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
visit project_merge_requests_path(project, state: 'closed')
end
it 'reopens merge request' do
change_status('Open')
expect(page).to have_selector('.merge-request', count: 0)
end
end
end
context 'assignee', :js do
describe 'set assignee' do
before do
visit project_merge_requests_path(project)
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
visit project_merge_requests_path(project)
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 do
let(:milestone) { create(:milestone, project: project) }
describe 'set milestone' do
before do
visit project_merge_requests_path(project)
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
visit project_merge_requests_path(project)
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)
click_button 'Edit merge requests'
find('#check-all-issues').click
find('.js-issue-status').click
find('.dropdown-menu-status a', text: text).click
click_update_merge_requests_button
end
def change_assignee(text)
click_button 'Edit merge requests'
find('#check-all-issues').click
find('.js-update-assignee').click
wait_for_requests
page.within '.dropdown-menu-user' do
click_link text
end
click_update_merge_requests_button
end
def change_milestone(text)
click_button 'Edit merge requests'
find('#check-all-issues').click
find('.issues-bulk-update .js-milestone-select').click
find('.dropdown-menu-milestone a', text: text).click
click_update_merge_requests_button
end
def click_update_merge_requests_button
find('.update-selected-issues').click
wait_for_requests
end
end