debian-mirror-gitlab/spec/features/merge_request/user_assigns_themselves_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
2 KiB
Ruby
Raw Permalink Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2018-03-17 18:26:18 +05:30
2023-03-17 16:20:25 +05:30
RSpec.describe 'Merge request > User assigns themselves', feature_category: :code_review_workflow do
2018-03-17 18:26:18 +05:30
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
let(:issue1) { create(:issue, project: project) }
let(:issue2) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project, author: user, description: "fixes #{issue1.to_reference} and #{issue2.to_reference}") }
context 'logged in as a member of the project' do
before do
sign_in(user)
visit project_merge_request_path(project, merge_request)
end
2021-12-11 22:18:48 +05:30
it 'updates related issues', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/343006' do
2018-03-17 18:26:18 +05:30
click_link 'Assign yourself to these issues'
expect(page).to have_content '2 issues have been assigned to you'
end
2020-11-24 15:15:51 +05:30
it 'updates updated_by', :js do
2023-03-04 22:38:38 +05:30
wait_for_requests
2020-11-24 15:15:51 +05:30
expect do
2023-03-04 22:38:38 +05:30
page.within('[data-testid="assignee-block-container"]') do
click_button 'assign yourself'
end
2020-11-24 15:15:51 +05:30
expect(find('.assignee')).to have_content(user.name)
wait_for_all_requests
end.to change { merge_request.reload.updated_at }
end
2018-03-17 18:26:18 +05:30
context 'when related issues are already assigned' do
before do
[issue1, issue2].each { |issue| issue.update!(assignees: [user]) }
end
it 'does not display if related issues are already assigned' do
2023-03-04 22:38:38 +05:30
page.within('[data-testid="assignee-block-container"]') do
expect(page).not_to have_content 'Assign yourself'
end
2018-03-17 18:26:18 +05:30
end
end
end
context 'logged in as a non-member of the project' do
before do
sign_in(create(:user))
visit project_merge_request_path(project, merge_request)
end
2019-02-15 15:39:39 +05:30
it 'does not show assignment link' do
2023-03-04 22:38:38 +05:30
page.within('[data-testid="assignee-block-container"]') do
expect(page).not_to have_content 'Assign yourself'
end
2018-03-17 18:26:18 +05:30
end
end
end