Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
13d9c5dd
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,发现更多精彩内容 >>
提交
13d9c5dd
编写于
6月 28, 2019
作者:
F
Fabio Papa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Style rules; Revert some examples
上级
ec802d64
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
52 addition
and
22 deletion
+52
-22
db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
.../20190626175626_add_group_creation_level_to_namespaces.rb
+5
-2
spec/controllers/admin/groups_controller_spec.rb
spec/controllers/admin/groups_controller_spec.rb
+7
-2
spec/features/groups/group_settings_spec.rb
spec/features/groups/group_settings_spec.rb
+1
-1
spec/features/groups/show_spec.rb
spec/features/groups/show_spec.rb
+17
-7
spec/models/group_spec.rb
spec/models/group_spec.rb
+2
-1
spec/policies/group_policy_spec.rb
spec/policies/group_policy_spec.rb
+16
-5
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+2
-2
spec/services/groups/create_service_spec.rb
spec/services/groups/create_service_spec.rb
+2
-2
未找到文件。
db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
浏览文件 @
13d9c5dd
...
...
@@ -5,10 +5,13 @@ class AddGroupCreationLevelToNamespaces < ActiveRecord::Migration[5.1]
DOWNTIME
=
false
disable_ddl_transaction!
def
up
unless
column_exists?
(
:namespaces
,
:subgroup_creation_level
)
add_column_with_default
(
:namespaces
,
:subgroup_creation_level
,
:integer
,
default:
0
)
add_column_with_default
(
:namespaces
,
:subgroup_creation_level
,
:integer
,
default:
0
)
end
end
...
...
spec/controllers/admin/groups_controller_spec.rb
浏览文件 @
13d9c5dd
...
...
@@ -70,9 +70,14 @@ describe Admin::GroupsController do
end
it
'updates the subgroup_creation_level successfully'
do
MAINTAINER
=
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
expect
do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
subgroup_creation_level:
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
}
}
end
.
to
change
{
group
.
reload
.
subgroup_creation_level
}.
to
(
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
subgroup_creation_level:
MAINTAINER
}
}
end
.
to
change
{
group
.
reload
.
subgroup_creation_level
}
.
to
(
MAINTAINER
)
end
end
end
spec/features/groups/group_settings_spec.rb
浏览文件 @
13d9c5dd
...
...
@@ -92,7 +92,7 @@ describe 'Edit group settings' do
expect
(
page
).
to
have_content
(
'Allowed to create subgroups'
)
end
end
describe
'edit group avatar'
do
before
do
visit
edit_group_path
(
group
)
...
...
spec/features/groups/show_spec.rb
浏览文件 @
13d9c5dd
...
...
@@ -76,7 +76,8 @@ describe 'Group show page' do
end
it
'allows creating subgroups'
do
expect
(
page
).
to
have_css
(
"li[data-text='New subgroup']"
,
visible:
false
)
expect
(
page
)
.
to
have_css
(
"li[data-text='New subgroup']"
,
visible:
false
)
end
end
...
...
@@ -87,7 +88,8 @@ describe 'Group show page' do
end
it
'does not allow creating subgroups'
do
expect
(
page
).
not_to
have_selector
(
"li[data-text='New subgroup']"
,
visible:
false
)
expect
(
page
)
.
not_to
have_selector
(
"li[data-text='New subgroup']"
,
visible:
false
)
end
end
end
...
...
@@ -104,8 +106,11 @@ describe 'Group show page' do
end
context
'when subgroup_creation_level is set to maintainer'
do
let
(
:group
)
{
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
}
let
(
:group
)
do
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
end
it
'allows creating subgroups'
do
visit
path
expect
(
page
).
to
have_css
(
"li[data-text='New subgroup']"
,
visible:
false
)
...
...
@@ -113,11 +118,15 @@ describe 'Group show page' do
end
context
'when subgroup_creation_level is set to owners'
do
let
(
:group
)
{
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
)
}
let
(
:group
)
do
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
)
end
it
'does not allow creating subgroups'
do
visit
path
expect
(
page
).
not_to
have_css
(
"li[data-text='New subgroup']"
,
visible:
false
)
expect
(
page
)
.
not_to
have_css
(
"li[data-text='New subgroup']"
,
visible:
false
)
end
end
end
...
...
@@ -129,7 +138,8 @@ describe 'Group show page' do
end
it
'does not allow creating subgroups'
do
expect
(
page
).
not_to
have_selector
(
"li[data-text='New subgroup']"
,
visible:
false
)
expect
(
page
)
.
not_to
have_selector
(
"li[data-text='New subgroup']"
,
visible:
false
)
end
end
end
...
...
spec/models/group_spec.rb
浏览文件 @
13d9c5dd
...
...
@@ -999,7 +999,8 @@ describe Group do
it
'outputs the default one if it is nil'
do
group
=
create
(
:group
,
subgroup_creation_level:
nil
)
expect
(
group
.
subgroup_creation_level
).
to
eq
(
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
expect
(
group
.
subgroup_creation_level
)
.
to
eq
(
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
end
end
end
spec/policies/group_policy_spec.rb
浏览文件 @
13d9c5dd
...
...
@@ -145,7 +145,8 @@ describe GroupPolicy do
it
'allows every owner permission except creating subgroups'
do
create_subgroup_permission
=
[
:create_subgroup
]
updated_owner_permissions
=
owner_permissions
-
create_subgroup_permission
updated_owner_permissions
=
owner_permissions
-
create_subgroup_permission
expect_disallowed
(
*
create_subgroup_permission
)
expect_allowed
(
*
updated_owner_permissions
)
...
...
@@ -157,7 +158,8 @@ describe GroupPolicy do
it
'allows every owner permission except creating subgroups'
do
create_subgroup_permission
=
[
:create_subgroup
]
updated_owner_permissions
=
owner_permissions
-
create_subgroup_permission
updated_owner_permissions
=
owner_permissions
-
create_subgroup_permission
expect_disallowed
(
*
create_subgroup_permission
)
expect_allowed
(
*
updated_owner_permissions
)
...
...
@@ -169,7 +171,8 @@ describe GroupPolicy do
it
'allows every maintainer permission except creating subgroups'
do
create_subgroup_permission
=
[
:create_subgroup
]
updated_maintainer_permissions
=
maintainer_permissions
-
create_subgroup_permission
updated_maintainer_permissions
=
maintainer_permissions
-
create_subgroup_permission
expect_disallowed
(
*
create_subgroup_permission
)
expect_allowed
(
*
updated_maintainer_permissions
)
...
...
@@ -475,7 +478,11 @@ describe GroupPolicy do
context
"create_subgroup"
do
context
'when group has subgroup creation level set to owner'
do
let
(
:group
)
{
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
)
}
let
(
:group
)
do
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
)
end
context
'reporter'
do
let
(
:current_user
)
{
reporter
}
...
...
@@ -503,7 +510,11 @@ describe GroupPolicy do
end
context
'when group has subgroup creation level set to maintainer'
do
let
(
:group
)
{
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
}
let
(
:group
)
do
create
(
:group
,
subgroup_creation_level:
::
Gitlab
::
Access
::
MAINTAINER_SUBGROUP_ACCESS
)
end
context
'reporter'
do
let
(
:current_user
)
{
reporter
}
...
...
spec/requests/api/groups_spec.rb
浏览文件 @
13d9c5dd
...
...
@@ -803,10 +803,10 @@ describe API::Groups do
group2
.
add_maintainer
(
user1
)
end
it
'can create subgroups'
do
it
'can
not
create subgroups'
do
post
api
(
"/groups"
,
user1
),
params:
{
parent_id:
group2
.
id
,
name:
'foo'
,
path:
'foo'
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
end
...
...
spec/services/groups/create_service_spec.rb
浏览文件 @
13d9c5dd
...
...
@@ -89,9 +89,9 @@ describe Groups::CreateService, '#execute' do
it
{
is_expected
.
to
be_persisted
}
end
context
'as
maintai
ner'
do
context
'as
Ow
ner'
do
before
do
group
.
add_
maintai
ner
(
user
)
group
.
add_
ow
ner
(
user
)
end
it
{
is_expected
.
to
be_persisted
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录