Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ed16c351
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ed16c351
编写于
5月 22, 2017
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix specs
上级
4345bb8c
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
66 addition
and
52 deletion
+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
未找到文件。
config/routes/user.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
).
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录