Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
aac52ea6
Commit
aac52ea6
authored
Feb 08, 2022
by
Valerie Burton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor and move project when creating from group template spec
parent
75980735
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
49 deletions
+58
-49
ee/spec/features/projects/custom_projects_template_spec.rb
ee/spec/features/projects/custom_projects_template_spec.rb
+58
-16
ee/spec/features/projects_spec.rb
ee/spec/features/projects_spec.rb
+0
-33
No files found.
ee/spec/features/projects/custom_projects_template_spec.rb
View file @
aac52ea6
...
...
@@ -43,18 +43,16 @@ RSpec.describe 'Project' do
new_path
=
'example-custom-project-template'
new_name
=
'Example Custom Project Template'
click_link
'Create from template'
find
(
'.project-template .custom-instance-project-templates-tab'
).
click
find
(
"label[for='
#{
projects
.
first
.
name
}
']"
).
click
create_from_template
(
:instance
,
projects
.
first
.
name
)
page
.
within
'.project-fields-form'
do
fill_in
(
"project_name"
,
with:
new_name
)
fill_in
(
'project_name'
,
with:
new_name
)
# Have to reset it to '' so it overwrites rather than appends
fill_in
(
'project_path'
,
with:
''
)
fill_in
(
"project_path"
,
with:
new_path
)
fill_in
(
'project_path'
,
with:
new_path
)
Sidekiq
::
Testing
.
inline!
do
click_button
"Create project"
click_button
'Create project'
end
end
...
...
@@ -68,15 +66,13 @@ RSpec.describe 'Project' do
new_path
=
'example-custom-project-template'
new_name
=
'Example Custom Project Template'
click_link
'Create from template'
find
(
'.project-template .custom-instance-project-templates-tab'
).
click
find
(
"label[for='
#{
projects
.
first
.
name
}
']"
).
click
create_from_template
(
:instance
,
projects
.
first
.
name
)
page
.
within
'.project-fields-form'
do
fill_in
(
"project_name"
,
with:
new_name
)
fill_in
(
'project_name'
,
with:
new_name
)
Sidekiq
::
Testing
.
inline!
do
click_button
"Create project"
click_button
'Create project'
end
end
...
...
@@ -90,15 +86,13 @@ RSpec.describe 'Project' do
new_path
=
'example-custom-project-template'
new_name
=
'Example Custom Project Template'
click_link
'Create from template'
find
(
'.project-template .custom-instance-project-templates-tab'
).
click
find
(
"label[for='
#{
projects
.
first
.
name
}
']"
).
click
create_from_template
(
:instance
,
projects
.
first
.
name
)
page
.
within
'.project-fields-form'
do
fill_in
(
"project_path"
,
with:
new_path
)
fill_in
(
'project_path'
,
with:
new_path
)
Sidekiq
::
Testing
.
inline!
do
click_button
"Create project"
click_button
'Create project'
end
end
...
...
@@ -129,4 +123,52 @@ RSpec.describe 'Project' do
end
end
end
describe
'Custom group-level project templates'
,
:js
,
quarantine:
'https://gitlab.com/gitlab-org/gitlab/-/issues/348710'
do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:group
)
{
create
(
:group
,
name:
'parent-group'
)
}
let!
(
:template_subgroup
)
{
create
(
:group
,
parent:
group
,
name:
'template-subgroup'
)
}
let!
(
:template
)
{
create
(
:project
,
namespace:
template_subgroup
)
}
before
do
stub_licensed_features
(
custom_project_templates:
true
)
group
.
add_owner
(
user
)
group
.
update!
(
custom_project_templates_group_id:
template_subgroup
.
id
)
sign_in
user
end
context
'from default new project path'
do
it
'displays user namespace for default project URL'
do
visit
new_project_path
create_from_template
(
:group
,
template
.
name
)
expect
(
page
).
to
have_button
(
user
.
username
,
exact:
true
)
end
end
context
'from subgroup new project path'
do
let!
(
:other_subgroup
)
{
create
(
:group
,
parent:
group
,
name:
'other-subgroup'
)
}
it
'displays subgroup namespace for default project URL'
do
visit
new_project_path
(
namespace_id:
other_subgroup
.
id
)
create_from_template
(
:group
,
template
.
name
)
expect
(
page
).
to
have_button
(
"
#{
group
.
name
}
/
#{
other_subgroup
.
name
}
"
,
exact:
true
)
end
end
end
def
create_from_template
(
type
,
template_name
)
tab
=
if
type
==
:instance
'.custom-instance-project-templates-tab'
elsif
type
==
:group
'.custom-group-project-templates-tab'
else
raise
ArgumentError
,
"
#{
type
}
is not a valid template type"
end
click_link
'Create from template'
find
(
tab
).
click
find
(
"label[for=
#{
template_name
}
]"
).
click
end
end
ee/spec/features/projects_spec.rb
View file @
aac52ea6
...
...
@@ -3,39 +3,6 @@
require
'spec_helper'
RSpec
.
describe
'Project'
,
:js
do
describe
'when creating from group template'
,
quarantine:
'https://gitlab.com/gitlab-org/gitlab/-/issues/222234'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
name:
'parent-group'
)
}
let
(
:template_subgroup
)
{
create
(
:group
,
parent:
group
,
name:
'template-subgroup'
)
}
let
(
:other_subgroup
)
{
create
(
:group
,
parent:
group
,
name:
'other-subgroup'
)
}
let
(
:template
)
{
create
(
:project
,
namespace:
template_subgroup
)
}
before
do
stub_licensed_features
(
custom_project_templates:
true
)
group
.
add_owner
(
user
)
group
.
update!
(
custom_project_templates_group_id:
template_subgroup
.
id
)
sign_in
user
end
it
"defaults to correct namespace"
do
visit
new_project_path
click_link
'Create from template'
find
(
'.custom-group-project-templates-tab'
).
click
find
(
"label[for=
#{
template
.
name
}
]"
).
click
expect
(
find
(
'.js-select-namespace'
)).
to
have_content
group
.
name
end
it
"uses supplied namespace"
do
visit
new_project_path
(
namespace_id:
other_subgroup
.
id
)
click_link
'Create from template'
find
(
'.custom-group-project-templates-tab'
).
click
find
(
"label[for=
#{
template
.
name
}
]"
).
click
expect
(
find
(
'.js-select-namespace'
)).
to
have_content
other_subgroup
.
name
end
end
describe
'immediately deleting a project marked for deletion'
do
let
(
:project
)
{
create
(
:project
,
marked_for_deletion_at:
Date
.
current
)
}
let
(
:user
)
{
project
.
first_owner
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment