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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
ed16c351
Commit
ed16c351
authored
May 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
4345bb8c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
52 deletions
+66
-52
config/routes/user.rb
config/routes/user.rb
+1
-1
doc/user/group/subgroups/index.md
doc/user/group/subgroups/index.md
+2
-2
spec/controllers/import/bitbucket_controller_spec.rb
spec/controllers/import/bitbucket_controller_spec.rb
+12
-9
spec/controllers/import/gitlab_controller_spec.rb
spec/controllers/import/gitlab_controller_spec.rb
+13
-10
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb
...ame_reserved_paths_migration/v1/rename_namespaces_spec.rb
+26
-26
spec/support/controllers/githubish_import_controller_shared_examples.rb
...ontrollers/githubish_import_controller_shared_examples.rb
+12
-4
No files found.
config/routes/user.rb
View file @
ed16c351
...
...
@@ -22,7 +22,7 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d
get
:contributed
,
as: :contributed_projects
get
:snippets
get
:exists
get
'/'
,
to:
redirect
(
'/%{username}'
)
get
'/'
,
to:
redirect
(
'/%{username}'
)
,
as:
nil
end
# Compatibility with old routing
...
...
doc/user/group/subgroups/index.md
View file @
ed16c351
...
...
@@ -71,7 +71,7 @@ structure.
-
You need to be an Owner of a group in order to be able to create
a subgroup. For more information check the
[
permissions table
][
permissions
]
.
-
For a list of words that are not allowed to be used as group names see the
[
`
dynamic_path_validator
.rb` file
][
reserved
]
under the
`TOP_LEVEL_ROUTES`
,
`PROJECT_WILDCARD_ROUTES`
and
`GROUP_ROUTES`
lists:
[
`
path_regex
.rb` file
][
reserved
]
under the
`TOP_LEVEL_ROUTES`
,
`PROJECT_WILDCARD_ROUTES`
and
`GROUP_ROUTES`
lists:
-
`TOP_LEVEL_ROUTES`
: are names that are reserved as usernames or top level groups
-
`PROJECT_WILDCARD_ROUTES`
: are names that are reserved for child groups or projects.
-
`GROUP_ROUTES`
: are names that are reserved for all groups or projects.
...
...
@@ -163,4 +163,4 @@ Here's a list of what you can't do with subgroups:
[
ce-2772
]:
https://gitlab.com/gitlab-org/gitlab-ce/issues/2772
[
permissions
]:
../../permissions.md#group
[
reserved
]:
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/
app/validators/dynamic_path_validator
.rb
[
reserved
]:
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/
lib/gitlab/path_regex
.rb
spec/controllers/import/bitbucket_controller_spec.rb
View file @
ed16c351
...
...
@@ -133,9 +133,13 @@ describe Import::BitbucketController do
end
context
"when a namespace with the Bitbucket user's username already exists"
do
let!
(
:existing_namespace
)
{
create
(
:
namespace
,
name:
other_username
,
owner:
user
)
}
let!
(
:existing_namespace
)
{
create
(
:
group
,
name:
other_username
)
}
context
"when the namespace is owned by the GitLab user"
do
before
do
existing_namespace
.
add_owner
(
user
)
end
it
"takes the existing namespace"
do
expect
(
Gitlab
::
BitbucketImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
bitbucket_repo
,
bitbucket_repo
.
name
,
existing_namespace
,
user
,
access_params
).
...
...
@@ -146,11 +150,6 @@ describe Import::BitbucketController do
end
context
"when the namespace is not owned by the GitLab user"
do
before
do
existing_namespace
.
owner
=
create
(
:user
)
existing_namespace
.
save
end
it
"doesn't create a project"
do
expect
(
Gitlab
::
BitbucketImport
::
ProjectCreator
).
not_to
receive
(
:new
)
...
...
@@ -202,10 +201,14 @@ describe Import::BitbucketController do
end
context
'user has chosen an existing nested namespace and name for the project'
do
let
(
:parent_namespace
)
{
create
(
:
namespace
,
name:
'foo'
,
owner:
user
)
}
let
(
:nested_namespace
)
{
create
(
:
namespace
,
name:
'bar'
,
parent:
parent_namespace
,
owner:
user
)
}
let
(
:parent_namespace
)
{
create
(
:
group
,
name:
'foo'
,
owner:
user
)
}
let
(
:nested_namespace
)
{
create
(
:
group
,
name:
'bar'
,
parent:
parent_namespace
)
}
let
(
:test_name
)
{
'test_name'
}
before
do
nested_namespace
.
add_owner
(
user
)
end
it
'takes the selected namespace and name'
do
expect
(
Gitlab
::
BitbucketImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
bitbucket_repo
,
test_name
,
nested_namespace
,
user
,
access_params
).
...
...
@@ -248,7 +251,7 @@ describe Import::BitbucketController do
context
'user has chosen existent and non-existent nested namespaces and name for the project'
do
let
(
:test_name
)
{
'test_name'
}
let!
(
:parent_namespace
)
{
create
(
:
namespace
,
name:
'foo'
,
owner:
user
)
}
let!
(
:parent_namespace
)
{
create
(
:
group
,
name:
'foo'
,
owner:
user
)
}
it
'takes the selected namespace and name'
do
expect
(
Gitlab
::
BitbucketImport
::
ProjectCreator
).
...
...
spec/controllers/import/gitlab_controller_spec.rb
View file @
ed16c351
...
...
@@ -108,9 +108,13 @@ describe Import::GitlabController do
end
context
"when a namespace with the GitLab.com user's username already exists"
do
let!
(
:existing_namespace
)
{
create
(
:
namespace
,
name:
other_username
,
owner:
user
)
}
let!
(
:existing_namespace
)
{
create
(
:
group
,
name:
other_username
)
}
context
"when the namespace is owned by the GitLab server user"
do
before
do
existing_namespace
.
add_owner
(
user
)
end
it
"takes the existing namespace"
do
expect
(
Gitlab
::
GitlabImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
gitlab_repo
,
existing_namespace
,
user
,
access_params
).
...
...
@@ -121,11 +125,6 @@ describe Import::GitlabController do
end
context
"when the namespace is not owned by the GitLab server user"
do
before
do
existing_namespace
.
owner
=
create
(
:user
)
existing_namespace
.
save
end
it
"doesn't create a project"
do
expect
(
Gitlab
::
GitlabImport
::
ProjectCreator
).
not_to
receive
(
:new
)
...
...
@@ -176,8 +175,12 @@ describe Import::GitlabController do
end
context
'user has chosen an existing nested namespace for the project'
do
let
(
:parent_namespace
)
{
create
(
:namespace
,
name:
'foo'
,
owner:
user
)
}
let
(
:nested_namespace
)
{
create
(
:namespace
,
name:
'bar'
,
parent:
parent_namespace
,
owner:
user
)
}
let
(
:parent_namespace
)
{
create
(
:group
,
name:
'foo'
,
owner:
user
)
}
let
(
:nested_namespace
)
{
create
(
:group
,
name:
'bar'
,
parent:
parent_namespace
)
}
before
do
nested_namespace
.
add_owner
(
user
)
end
it
'takes the selected namespace and name'
do
expect
(
Gitlab
::
GitlabImport
::
ProjectCreator
).
...
...
@@ -221,7 +224,7 @@ describe Import::GitlabController do
context
'user has chosen existent and non-existent nested namespaces and name for the project'
do
let
(
:test_name
)
{
'test_name'
}
let!
(
:parent_namespace
)
{
create
(
:
namespace
,
name:
'foo'
,
owner:
user
)
}
let!
(
:parent_namespace
)
{
create
(
:
group
,
name:
'foo'
,
owner:
user
)
}
it
'takes the selected namespace and name'
do
expect
(
Gitlab
::
GitlabImport
::
ProjectCreator
).
...
...
spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb
View file @
ed16c351
...
...
@@ -18,8 +18,8 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
let
(
:subject
)
{
described_class
.
new
([
'parent/the-Path'
],
migration
)
}
it
'includes the namespace'
do
parent
=
create
(
:
namespace
,
path:
'parent'
)
child
=
create
(
:
namespace
,
path:
'the-path'
,
parent:
parent
)
parent
=
create
(
:
group
,
path:
'parent'
)
child
=
create
(
:
group
,
path:
'the-path'
,
parent:
parent
)
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
map
(
&
:id
)
...
...
@@ -30,13 +30,13 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
context
'for child namespaces'
do
it
'only returns child namespaces with the correct path'
do
_root_namespace
=
create
(
:
namespace
,
path:
'THE-path'
)
_other_path
=
create
(
:
namespace
,
_root_namespace
=
create
(
:
group
,
path:
'THE-path'
)
_other_path
=
create
(
:
group
,
path:
'other'
,
parent:
create
(
:
namespace
))
namespace
=
create
(
:
namespace
,
parent:
create
(
:
group
))
namespace
=
create
(
:
group
,
path:
'the-path'
,
parent:
create
(
:
namespace
))
parent:
create
(
:
group
))
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
map
(
&
:id
)
...
...
@@ -45,13 +45,13 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
end
it
'has no namespaces that look the same'
do
_root_namespace
=
create
(
:
namespace
,
path:
'THE-path'
)
_similar_path
=
create
(
:
namespace
,
_root_namespace
=
create
(
:
group
,
path:
'THE-path'
)
_similar_path
=
create
(
:
group
,
path:
'not-really-the-path'
,
parent:
create
(
:
namespace
))
namespace
=
create
(
:
namespace
,
parent:
create
(
:
group
))
namespace
=
create
(
:
group
,
path:
'the-path'
,
parent:
create
(
:
namespace
))
parent:
create
(
:
group
))
found_ids
=
subject
.
namespaces_for_paths
(
type: :child
).
map
(
&
:id
)
...
...
@@ -62,11 +62,11 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
context
'for top levelnamespaces'
do
it
'only returns child namespaces with the correct path'
do
root_namespace
=
create
(
:
namespace
,
path:
'the-path'
)
_other_path
=
create
(
:
namespace
,
path:
'other'
)
_child_namespace
=
create
(
:
namespace
,
root_namespace
=
create
(
:
group
,
path:
'the-path'
)
_other_path
=
create
(
:
group
,
path:
'other'
)
_child_namespace
=
create
(
:
group
,
path:
'the-path'
,
parent:
create
(
:
namespace
))
parent:
create
(
:
group
))
found_ids
=
subject
.
namespaces_for_paths
(
type: :top_level
).
map
(
&
:id
)
...
...
@@ -75,11 +75,11 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
end
it
'has no namespaces that just look the same'
do
root_namespace
=
create
(
:
namespace
,
path:
'the-path'
)
_similar_path
=
create
(
:
namespace
,
path:
'not-really-the-path'
)
_child_namespace
=
create
(
:
namespace
,
root_namespace
=
create
(
:
group
,
path:
'the-path'
)
_similar_path
=
create
(
:
group
,
path:
'not-really-the-path'
)
_child_namespace
=
create
(
:
group
,
path:
'the-path'
,
parent:
create
(
:
namespace
))
parent:
create
(
:
group
))
found_ids
=
subject
.
namespaces_for_paths
(
type: :top_level
).
map
(
&
:id
)
...
...
@@ -124,10 +124,10 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
describe
"#child_ids_for_parent"
do
it
"collects child ids for all levels"
do
parent
=
create
(
:
namespace
)
first_child
=
create
(
:
namespace
,
parent:
parent
)
second_child
=
create
(
:
namespace
,
parent:
parent
)
third_child
=
create
(
:
namespace
,
parent:
second_child
)
parent
=
create
(
:
group
)
first_child
=
create
(
:
group
,
parent:
parent
)
second_child
=
create
(
:
group
,
parent:
parent
)
third_child
=
create
(
:
group
,
parent:
second_child
)
all_ids
=
[
parent
.
id
,
first_child
.
id
,
second_child
.
id
,
third_child
.
id
]
collected_ids
=
subject
.
child_ids_for_parent
(
parent
,
ids:
[
parent
.
id
])
...
...
@@ -205,9 +205,9 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
end
describe
'#rename_namespaces'
do
let!
(
:top_level_namespace
)
{
create
(
:
namespace
,
path:
'the-path'
)
}
let!
(
:top_level_namespace
)
{
create
(
:
group
,
path:
'the-path'
)
}
let!
(
:child_namespace
)
do
create
(
:
namespace
,
path:
'the-path'
,
parent:
create
(
:namespace
))
create
(
:
group
,
path:
'the-path'
,
parent:
create
(
:group
))
end
it
'renames top level namespaces the namespace'
do
...
...
spec/support/controllers/githubish_import_controller_shared_examples.rb
View file @
ed16c351
...
...
@@ -209,9 +209,13 @@ shared_examples 'a GitHub-ish import controller: POST create' do
end
context
'user has chosen a namespace and name for the project'
do
let
(
:test_namespace
)
{
create
(
:
namespace
,
name:
'test_namespace'
,
owner:
user
)
}
let
(
:test_namespace
)
{
create
(
:
group
,
name:
'test_namespace'
)
}
let
(
:test_name
)
{
'test_name'
}
before
do
test_namespace
.
add_owner
(
user
)
end
it
'takes the selected namespace and name'
do
expect
(
Gitlab
::
GithubImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
test_namespace
,
user
,
access_params
,
type:
provider
).
...
...
@@ -230,10 +234,14 @@ shared_examples 'a GitHub-ish import controller: POST create' do
end
context
'user has chosen an existing nested namespace and name for the project'
do
let
(
:parent_namespace
)
{
create
(
:
namespace
,
name:
'foo'
,
owner:
user
)
}
let
(
:nested_namespace
)
{
create
(
:
namespace
,
name:
'bar'
,
parent:
parent_namespace
,
owner:
user
)
}
let
(
:parent_namespace
)
{
create
(
:
group
,
name:
'foo'
,
owner:
user
)
}
let
(
:nested_namespace
)
{
create
(
:
group
,
name:
'bar'
,
parent:
parent_namespace
)
}
let
(
:test_name
)
{
'test_name'
}
before
do
nested_namespace
.
add_owner
(
user
)
end
it
'takes the selected namespace and name'
do
expect
(
Gitlab
::
GithubImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
nested_namespace
,
user
,
access_params
,
type:
provider
).
...
...
@@ -276,7 +284,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
context
'user has chosen existent and non-existent nested namespaces and name for the project'
do
let
(
:test_name
)
{
'test_name'
}
let!
(
:parent_namespace
)
{
create
(
:
namespace
,
name:
'foo'
,
owner:
user
)
}
let!
(
:parent_namespace
)
{
create
(
:
group
,
name:
'foo'
,
owner:
user
)
}
it
'takes the selected namespace and name'
do
expect
(
Gitlab
::
GithubImport
::
ProjectCreator
).
...
...
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