debian-mirror-gitlab/spec/features/projects/user_creates_project_spec.rb

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

111 lines
3.1 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'User creates a project', :js do
2017-09-10 17:25:29 +05:30
let(:user) { create(:user) }
before do
sign_in(user)
create(:personal_key, user: user)
end
it 'creates a new project' do
2018-03-17 18:26:18 +05:30
visit(new_project_path)
2021-12-11 22:18:48 +05:30
click_link 'Create blank project'
2018-11-20 20:47:30 +05:30
fill_in(:project_name, with: 'Empty')
2017-09-10 17:25:29 +05:30
2021-03-11 19:13:27 +05:30
expect(page).to have_checked_field 'Initialize repository with a README'
uncheck 'Initialize repository with a README'
2017-09-10 17:25:29 +05:30
page.within('#content-body') do
click_button('Create project')
end
project = Project.last
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path(project_path(project), ignore_query: true)
2017-09-10 17:25:29 +05:30
expect(page).to have_content('Empty')
expect(page).to have_content('git init')
expect(page).to have_content('git remote')
expect(page).to have_content(project.url_to_repo)
end
2018-03-17 18:26:18 +05:30
2021-11-18 22:05:49 +05:30
it 'creates a new project that is not blank' do
2022-01-26 12:08:38 +05:30
visit(new_project_path)
click_link 'Create blank project'
fill_in(:project_name, with: 'With initial commits')
expect(page).to have_checked_field 'Initialize repository with a README'
expect(page).to have_unchecked_field 'Enable Static Application Security Testing (SAST)'
check 'Enable Static Application Security Testing (SAST)'
page.within('#content-body') do
2021-11-18 22:05:49 +05:30
click_button('Create project')
end
project = Project.last
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path(project_path(project), ignore_query: true)
2021-11-18 22:05:49 +05:30
expect(page).to have_content('With initial commits')
expect(page).to have_content('Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist')
expect(page).to have_content('README.md Initial commit')
end
2019-10-12 21:52:04 +05:30
context 'in a subgroup they do not own' do
2018-03-17 18:26:18 +05:30
let(:parent) { create(:group) }
let!(:subgroup) { create(:group, parent: parent) }
before do
parent.add_owner(user)
end
it 'creates a new project' do
visit(new_project_path)
2021-12-11 22:18:48 +05:30
click_link 'Create blank project'
2018-11-20 20:47:30 +05:30
fill_in :project_name, with: 'A Subgroup Project'
2018-03-17 18:26:18 +05:30
fill_in :project_path, with: 'a-subgroup-project'
2022-06-21 17:19:12 +05:30
click_on 'Pick a group or namespace'
2022-03-02 08:16:31 +05:30
click_button subgroup.full_path
2018-03-17 18:26:18 +05:30
2022-03-02 08:16:31 +05:30
click_button('Create project')
2018-03-17 18:26:18 +05:30
2018-11-20 20:47:30 +05:30
expect(page).to have_content("Project 'A Subgroup Project' was successfully created")
2018-03-17 18:26:18 +05:30
project = Project.last
expect(project.namespace).to eq(subgroup)
end
end
2019-07-07 11:18:12 +05:30
context 'in a group with DEVELOPER_MAINTAINER_PROJECT_ACCESS project_creation_level' do
let(:group) { create(:group, project_creation_level: ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS) }
before do
group.add_developer(user)
end
it 'creates a new project' do
visit(new_project_path)
2021-12-11 22:18:48 +05:30
click_link 'Create blank project'
2019-07-07 11:18:12 +05:30
fill_in :project_name, with: 'a-new-project'
fill_in :project_path, with: 'a-new-project'
page.within('#content-body') do
click_button('Create project')
end
expect(page).to have_content("Project 'a-new-project' was successfully created")
project = Project.find_by(name: 'a-new-project')
expect(project.namespace).to eq(group)
end
end
2017-09-10 17:25:29 +05:30
end