2019-09-04 21:01:54 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Project', feature_category: :projects do
|
2018-03-17 18:26:18 +05:30
|
|
|
include ProjectForksHelper
|
2018-11-20 20:47:30 +05:30
|
|
|
include MobileHelpers
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
describe 'template' do
|
2019-03-02 22:35:43 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in user
|
|
|
|
visit new_project_path
|
|
|
|
end
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
shared_examples 'creates from template' do |template, sub_template_tab = nil|
|
2022-06-21 17:19:12 +05:30
|
|
|
let(:selected_template) { page.find('.project-fields-form .selected-template') }
|
|
|
|
|
|
|
|
choose_template_selector = '.choose-template'
|
|
|
|
template_option_selector = '.template-option'
|
|
|
|
template_name_selector = '.description strong'
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
it "is created from template", :js do
|
2021-12-11 22:18:48 +05:30
|
|
|
click_link 'Create from template'
|
2021-01-03 14:25:43 +05:30
|
|
|
find(".project-template #{sub_template_tab}").click if sub_template_tab
|
|
|
|
find("label[for=#{template.name}]").click
|
|
|
|
fill_in("project_name", with: template.name)
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
page.within '#content-body' do
|
|
|
|
click_button "Create project"
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content template.name
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
it 'is created using keyboard navigation', :js do
|
|
|
|
click_link 'Create from template'
|
|
|
|
|
|
|
|
first_template = first(template_option_selector)
|
|
|
|
first_template_name = first_template.find(template_name_selector).text
|
|
|
|
first_template.find(choose_template_selector).click
|
|
|
|
|
|
|
|
expect(selected_template).to have_text(first_template_name)
|
|
|
|
|
|
|
|
click_button "Change template"
|
|
|
|
find("#built-in").click
|
|
|
|
|
|
|
|
# Jumps down 1 template, skipping the `preview` buttons
|
|
|
|
2.times do
|
|
|
|
page.send_keys :tab
|
|
|
|
end
|
|
|
|
|
|
|
|
# Ensure the template with focus is selected
|
|
|
|
project_name = "project from template"
|
|
|
|
focused_template = page.find(':focus').ancestor(template_option_selector)
|
|
|
|
focused_template_name = focused_template.find(template_name_selector).text
|
|
|
|
focused_template.find(choose_template_selector).send_keys :enter
|
|
|
|
fill_in "project_name", with: project_name
|
|
|
|
|
|
|
|
expect(selected_template).to have_text(focused_template_name)
|
|
|
|
|
|
|
|
page.within '#content-body' do
|
|
|
|
click_button "Create project"
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content project_name
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
context 'create with project template' do
|
|
|
|
it_behaves_like 'creates from template', Gitlab::ProjectTemplate.find(:rails)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'create with sample data template' do
|
2021-02-22 17:27:13 +05:30
|
|
|
it_behaves_like 'creates from template', Gitlab::SampleDataTemplate.find(:sample)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
describe 'shows tip about push to create git command' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in user
|
|
|
|
visit new_project_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the command in a popover', :js do
|
2021-02-22 17:27:13 +05:30
|
|
|
click_link 'Show command'
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
expect(page).to have_css('.popover #push-to-create-tip')
|
2018-03-27 19:54:05 +05:30
|
|
|
expect(page).to have_content 'Private projects can be created in your personal namespace with:'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
describe 'description' do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:path) { project_path(project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
before do
|
2022-04-04 11:22:00 +05:30
|
|
|
sign_in(project.first_owner)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
it 'parses Markdown' do
|
|
|
|
project.update_attribute(:description, 'This is **my** project')
|
|
|
|
visit path
|
2019-03-02 22:35:43 +05:30
|
|
|
expect(page).to have_css('.home-panel-description > .home-panel-description-markdown > p > strong')
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'passes through html-pipeline' do
|
|
|
|
project.update_attribute(:description, 'This project is the :poop:')
|
|
|
|
visit path
|
2019-03-02 22:35:43 +05:30
|
|
|
expect(page).to have_css('.home-panel-description > .home-panel-description-markdown > p > gl-emoji')
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'sanitizes unwanted tags' do
|
|
|
|
project.update_attribute(:description, "```\ncode\n```")
|
|
|
|
visit path
|
2019-03-02 22:35:43 +05:30
|
|
|
expect(page).not_to have_css('.home-panel-description code')
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'permits `rel` attribute on links' do
|
|
|
|
project.update_attribute(:description, 'https://google.com/')
|
|
|
|
visit path
|
2019-03-02 22:35:43 +05:30
|
|
|
expect(page).to have_css('.home-panel-description a[rel]')
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'read more', :js do
|
|
|
|
let(:read_more_selector) { '.read-more-container' }
|
2019-03-02 22:35:43 +05:30
|
|
|
let(:read_more_trigger_selector) { '.home-panel-home-desc .js-read-more-trigger' }
|
2018-11-20 20:47:30 +05:30
|
|
|
|
|
|
|
it 'does not display "read more" link on desktop breakpoint' do
|
|
|
|
project.update_attribute(:description, 'This is **my** project')
|
|
|
|
visit path
|
|
|
|
|
|
|
|
expect(find(read_more_trigger_selector, visible: false)).not_to be_visible
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays "read more" link on mobile breakpoint' do
|
|
|
|
project.update_attribute(:description, 'This is **my** project')
|
|
|
|
visit path
|
|
|
|
resize_screen_xs
|
|
|
|
|
|
|
|
find(read_more_trigger_selector).click
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
expect(page).to have_css('.home-panel-description .is-expanded')
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
context 'page description' do
|
|
|
|
before do
|
|
|
|
project.update_attribute(:description, '**Lorem** _ipsum_ dolor sit [amet](https://example.com)')
|
|
|
|
visit path
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page meta description', 'Lorem ipsum dolor sit amet'
|
|
|
|
end
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
describe 'project topics' do
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:path) { project_path(project) }
|
|
|
|
|
|
|
|
before do
|
2022-04-04 11:22:00 +05:30
|
|
|
sign_in(project.first_owner)
|
2019-03-02 22:35:43 +05:30
|
|
|
visit path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows project topics' do
|
2021-09-04 01:27:46 +05:30
|
|
|
project.update_attribute(:topic_list, 'topic1')
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
visit path
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
expect(page).to have_selector('[data-testid="project_topic_list"]')
|
2021-12-11 22:18:48 +05:30
|
|
|
expect(page).to have_link('topic1', href: topic_explore_projects_path(topic_name: 'topic1'))
|
2019-03-02 22:35:43 +05:30
|
|
|
end
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
it 'shows up to 3 project topics' do
|
|
|
|
project.update_attribute(:topic_list, 'topic1, topic2, topic3, topic4')
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
visit path
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
expect(page).to have_selector('[data-testid="project_topic_list"]')
|
2021-12-11 22:18:48 +05:30
|
|
|
expect(page).to have_link('topic1', href: topic_explore_projects_path(topic_name: 'topic1'))
|
|
|
|
expect(page).to have_link('topic2', href: topic_explore_projects_path(topic_name: 'topic2'))
|
|
|
|
expect(page).to have_link('topic3', href: topic_explore_projects_path(topic_name: 'topic3'))
|
2019-03-02 22:35:43 +05:30
|
|
|
expect(page).to have_content('+ 1 more')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
describe 'copy clone URL to clipboard', :js do
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:path) { project_path(project) }
|
|
|
|
|
|
|
|
before do
|
2022-04-04 11:22:00 +05:30
|
|
|
sign_in(project.first_owner)
|
2018-11-20 20:47:30 +05:30
|
|
|
visit path
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'desktop component' do
|
|
|
|
it 'shows on md and larger breakpoints' do
|
|
|
|
expect(find('.git-clone-holder')).to be_visible
|
|
|
|
expect(find('.mobile-git-clone', visible: false)).not_to be_visible
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'mobile component' do
|
|
|
|
it 'shows mobile component on sm and smaller breakpoints' do
|
|
|
|
resize_screen_xs
|
|
|
|
expect(find('.mobile-git-clone')).to be_visible
|
|
|
|
expect(find('.git-clone-holder', visible: false)).not_to be_visible
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
|
2023-03-17 16:20:25 +05:30
|
|
|
describe 'showing information about source of a project fork', :js do
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:user) { create(:user) }
|
2019-03-02 22:35:43 +05:30
|
|
|
let(:base_project) { create(:project, :public, :repository) }
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:forked_project) { fork_project(base_project, user, repository: true) }
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
before do
|
2018-03-17 18:26:18 +05:30
|
|
|
sign_in user
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it 'shows a link to the source project when it is available', :sidekiq_might_not_need_inline do
|
2018-03-17 18:26:18 +05:30
|
|
|
visit project_path(forked_project)
|
2023-03-17 16:20:25 +05:30
|
|
|
wait_for_requests
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(page).to have_content('Forked from')
|
|
|
|
expect(page).to have_link(base_project.full_name)
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'does not contain fork network information for the root project' do
|
|
|
|
forked_project
|
2016-04-02 18:10:28 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
visit project_path(base_project)
|
2023-03-17 16:20:25 +05:30
|
|
|
wait_for_requests
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content('In fork network of')
|
|
|
|
expect(page).not_to have_content('Forked from')
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it 'does not show the name of the deleted project when the source was deleted', :sidekiq_might_not_need_inline do
|
2018-03-17 18:26:18 +05:30
|
|
|
forked_project
|
2022-04-04 11:22:00 +05:30
|
|
|
Projects::DestroyService.new(base_project, base_project.first_owner).execute
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
visit project_path(forked_project)
|
2023-03-17 16:20:25 +05:30
|
|
|
wait_for_requests
|
2019-12-04 20:38:33 +05:30
|
|
|
expect(page).to have_content('Forked from an inaccessible project')
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
context 'a fork of a fork' do
|
|
|
|
let(:fork_of_fork) { fork_project(forked_project, user, repository: true) }
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
it 'links to the base project if the source project is removed', :sidekiq_might_not_need_inline do
|
2018-03-17 18:26:18 +05:30
|
|
|
fork_of_fork
|
|
|
|
Projects::DestroyService.new(forked_project, user).execute
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
visit project_path(fork_of_fork)
|
2023-03-17 16:20:25 +05:30
|
|
|
wait_for_requests
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_content("Forked from")
|
|
|
|
expect(page).to have_link(base_project.full_name)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2016-01-14 18:37:52 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
describe 'when the project repository is disabled', :js do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :repository_disabled, :repository, namespace: user.namespace) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
project.add_maintainer(user)
|
|
|
|
visit project_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show an error' do
|
|
|
|
wait_for_requests
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
expect(page).not_to have_selector('[data-testid="alert-danger"]')
|
2018-12-13 13:39:08 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'removal', :js do
|
2018-03-27 19:54:05 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
visit edit_project_path(project)
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
it 'focuses on the confirmation field' do
|
2020-10-24 23:57:45 +05:30
|
|
|
click_button 'Delete project'
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
expect(page).to have_selector '#confirm_name_input:focus'
|
|
|
|
end
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
it 'deletes a project', :sidekiq_inline do
|
2021-12-11 22:18:48 +05:30
|
|
|
expect { remove_with_confirm('Delete project', project.path_with_namespace, 'Yes, delete project') }.to change { Project.count }.by(-1)
|
2018-03-27 19:54:05 +05:30
|
|
|
expect(page).to have_content "Project '#{project.full_name}' is in the process of being deleted."
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(Project.all.count).to be_zero
|
|
|
|
expect(project.issues).to be_empty
|
|
|
|
expect(project.merge_requests).to be_empty
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
describe 'tree view (default view is set to Files)', :js do
|
2016-09-13 17:45:13 +05:30
|
|
|
let(:user) { create(:user, project_view: 'files') }
|
|
|
|
let(:project) { create(:forked_project_with_submodules) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
|
|
|
visit project_path(project)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'has working links to files' do
|
|
|
|
click_link('PROCESS.md')
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(page).to have_selector('.file-holder')
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'has working links to directories' do
|
|
|
|
click_link('encoding')
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(page).to have_selector('.breadcrumb-item', text: 'encoding')
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'has working links to submodules' do
|
2023-03-04 22:38:38 +05:30
|
|
|
submodule = find_link('645f6c4c')
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
expect(submodule[:href]).to eq('https://gitlab.com/gitlab-org/gitlab-grack/-/tree/645f6c4c82fd3f5e06f67134450a570b795e55a6')
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
context 'for signed commit on default branch', :js do
|
|
|
|
before do
|
|
|
|
project.change_head('33f3729a45c02fc67d00adb1b8bca394b0e761d9')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays a GPG badge' do
|
|
|
|
visit project_path(project)
|
|
|
|
wait_for_requests
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
expect(page).not_to have_selector '.js-loading-signature-badge'
|
|
|
|
expect(page).to have_selector '.gl-badge.badge-muted'
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
context 'for subgroups', :js do
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:subgroup) { create(:group, parent: group) }
|
|
|
|
let(:project) { create(:project, :repository, group: subgroup) }
|
|
|
|
|
|
|
|
it 'renders tree table without errors' do
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_selector('.tree-item')
|
2022-04-04 11:22:00 +05:30
|
|
|
expect(page).not_to have_selector('[data-testid="alert-danger"]')
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'for signed commit' do
|
|
|
|
before do
|
|
|
|
repository = project.repository
|
|
|
|
repository.write_ref("refs/heads/#{project.default_branch}", '33f3729a45c02fc67d00adb1b8bca394b0e761d9')
|
|
|
|
repository.expire_branches_cache
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays a GPG badge' do
|
|
|
|
visit project_path(project)
|
|
|
|
wait_for_requests
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
expect(page).not_to have_selector '.gl-badge.js-loading-signature-badge'
|
|
|
|
expect(page).to have_selector '.gl-badge.badge-muted'
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe 'activity view' do
|
|
|
|
let(:user) { create(:user, project_view: 'activity') }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
|
|
|
visit project_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'loads activity', :js do
|
|
|
|
expect(page).to have_selector('.event-item')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
context 'content is not cached after signing out', :js do
|
|
|
|
let(:user) { create(:user, project_view: 'activity') }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
it 'does not load activity', :js do
|
|
|
|
project.add_maintainer(user)
|
|
|
|
sign_in(user)
|
|
|
|
visit project_path(project)
|
|
|
|
sign_out(user)
|
|
|
|
|
|
|
|
page.evaluate_script('window.history.back()')
|
|
|
|
|
|
|
|
expect(page).not_to have_selector('.event-item')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
describe 'edit' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
let(:path) { edit_project_path(project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_maintainer(user)
|
|
|
|
sign_in(user)
|
|
|
|
visit path
|
|
|
|
end
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
it_behaves_like 'dirty submit form', [{ form: '.js-general-settings-form', input: 'input[name="project[name]"]', submit: 'button[type="submit"]' }]
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
|
|
|
|
2021-12-07 22:27:20 +05:30
|
|
|
describe 'view for a user without an access to a repo' do
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
it 'does not contain default branch information in its content' do
|
|
|
|
default_branch = 'merge-commit-analyze-side-branch'
|
|
|
|
|
|
|
|
project.add_guest(user)
|
|
|
|
project.change_head(default_branch)
|
|
|
|
|
|
|
|
sign_in(user)
|
|
|
|
visit project_path(project)
|
|
|
|
|
|
|
|
lines_with_default_branch = page.html.lines.select { |line| line.include?(default_branch) }
|
|
|
|
expect(lines_with_default_branch).to eq([])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
def remove_with_confirm(button_text, confirm_with, confirm_button_text = 'Confirm')
|
2015-11-26 14:37:03 +05:30
|
|
|
click_button button_text
|
|
|
|
fill_in 'confirm_name_input', with: confirm_with
|
2020-10-24 23:57:45 +05:30
|
|
|
click_button confirm_button_text
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|