Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c93e8f24
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,发现更多精彩内容 >>
提交
c93e8f24
编写于
8月 31, 2017
作者:
M
Michael Kozono
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add post-nested group Share lock integration tests
上级
a1a4754b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
86 addition
and
34 deletion
+86
-34
spec/features/projects/members/share_with_group_spec.rb
spec/features/projects/members/share_with_group_spec.rb
+86
-34
未找到文件。
spec/features/projects/members/share_with_group_spec.rb
浏览文件 @
c93e8f24
...
...
@@ -4,50 +4,106 @@ feature 'Project > Members > Share with Group', :js do
include
Select2Helper
include
ActionView
::
Helpers
::
DateHelper
describe
'Share Lock'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let!
(
:other_group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:master
)
{
create
(
:user
)
}
background
do
project
.
add_master
(
master
)
sign_in
(
master
)
describe
'Share Lock'
do
shared_examples
'the project can be shared with groups'
do
scenario
'the "Share with group" tab exists'
do
visit
project_settings_members_path
(
project
)
expect
(
page
).
to
have_selector
(
'#share-with-group-tab'
)
end
end
context
'when the group does not have "Share lock" enabled
'
do
before
do
shared_examples
'the project cannot be shared with groups
'
do
scenario
'the "Share with group" tab does not exist'
do
visit
project_settings_members_path
(
project
)
expect
(
page
).
to
have_selector
(
'#add-member-tab'
)
expect
(
page
).
not_to
have_selector
(
'#share-with-group-tab'
)
end
end
click_on
'share-with-group-tab'
context
'for a project in a root group'
do
let!
(
:group_to_share_with
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
create
(
:group
))
}
background
do
project
.
add_master
(
master
)
sign_in
(
master
)
end
select2
other_group
.
id
,
from:
'#link_group_id'
page
.
find
(
'body'
).
click
find
(
'.btn-create'
).
trigger
(
'click'
)
context
'when the group has "Share lock" disabled'
do
it_behaves_like
'the project can be shared with groups'
scenario
'the project can be shared with another group'
do
visit
project_settings_members_path
(
project
)
click_on
'share-with-group-tab'
select2
group_to_share_with
.
id
,
from:
'#link_group_id'
page
.
find
(
'body'
).
click
find
(
'.btn-create'
).
trigger
(
'click'
)
page
.
within
(
'.project-members-groups'
)
do
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
end
end
end
scenario
'the group link appears in the existing groups list
'
do
page
.
within
(
'.project-members-groups'
)
do
expect
(
page
).
to
have_content
(
other_group
.
nam
e
)
context
'when the group has "Share lock" enabled
'
do
before
do
project
.
namespace
.
update_column
(
:share_with_group_lock
,
tru
e
)
end
it_behaves_like
'the project cannot be shared with groups'
end
end
context
'when the group has "Share lock" enabled'
do
before
do
group
.
update_column
(
:share_with_group_lock
,
true
)
visit
project_settings_members_path
(
project
)
context
'for a project in a subgroup'
,
:postgresql
do
let!
(
:group_to_share_with
)
{
create
(
:group
)
}
let
(
:root_group
)
{
create
(
:group
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
root_group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
subgroup
)
}
background
do
project
.
add_master
(
master
)
sign_in
(
master
)
end
scenario
'the "Share with group" tab does not exist'
do
expect
(
page
).
to
have_selector
(
'#add-member-tab'
)
expect
(
page
).
not_to
have_selector
(
'#share-with-group-tab'
)
context
'when the root_group has "Share lock" disabled'
do
context
'when the subgroup has "Share lock" disabled'
do
it_behaves_like
'the project can be shared with groups'
end
context
'when the subgroup has "Share lock" enabled'
do
before
do
subgroup
.
update_column
(
:share_with_group_lock
,
true
)
end
it_behaves_like
'the project cannot be shared with groups'
end
end
context
'when the root_group has "Share lock" enabled'
do
before
do
root_group
.
update_column
(
:share_with_group_lock
,
true
)
end
context
'when the subgroup has "Share lock" disabled (parent overridden)'
do
it_behaves_like
'the project can be shared with groups'
end
context
'when the subgroup has "Share lock" enabled'
do
before
do
subgroup
.
update_column
(
:share_with_group_lock
,
true
)
end
it_behaves_like
'the project cannot be shared with groups'
end
end
end
end
describe
'setting an expiration date for a group link'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let!
(
:group
)
{
create
(
:group
)
}
...
...
@@ -83,17 +139,14 @@ feature 'Project > Members > Share with Group', :js do
describe
'the groups dropdown'
do
context
'with multiple groups to choose from'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:group
)
{
create
(
:group
)
}
background
do
project
.
add_master
(
master
)
sign_in
(
master
)
group_two
=
create
(
:group
)
group
.
add_owner
(
master
)
group_two
.
add_owner
(
master
)
create
(
:group
).
add_owner
(
master
)
create
(
:group
).
add_owner
(
master
)
visit
project_settings_members_path
(
project
)
execute_script
'GroupsSelect.PER_PAGE = 1;'
...
...
@@ -110,17 +163,16 @@ feature 'Project > Members > Share with Group', :js do
end
context
'for a project in a nested group'
do
let
(
:master
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let!
(
:nested_group
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:
another_group
)
{
create
(
:group
)
}
let!
(
:
group_to_share_with
)
{
create
(
:group
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
nested_group
)
}
background
do
project
.
add_master
(
master
)
sign_in
(
master
)
group
.
add_master
(
master
)
another_group
.
add_master
(
master
)
group_to_share_with
.
add_master
(
master
)
end
scenario
'the groups dropdown does not show ancestors'
,
:nested_groups
do
...
...
@@ -130,7 +182,7 @@ feature 'Project > Members > Share with Group', :js do
click_link
'Search for a group'
page
.
within
'.select2-drop'
do
expect
(
page
).
to
have_content
(
another_group
.
name
)
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
expect
(
page
).
not_to
have_content
(
group
.
name
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录