Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
00290b92
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,发现更多精彩内容 >>
提交
00290b92
编写于
10月 21, 2011
作者:
G
gitlabhq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test cov
上级
72d15cc7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
25 deletion
+29
-25
app/controllers/team_members_controller.rb
app/controllers/team_members_controller.rb
+7
-21
spec/requests/team_members_spec.rb
spec/requests/team_members_spec.rb
+22
-4
未找到文件。
app/controllers/team_members_controller.rb
浏览文件 @
00290b92
...
...
@@ -8,35 +8,16 @@ class TeamMembersController < ApplicationController
def
show
@team_member
=
project
.
users_projects
.
find
(
params
[
:id
])
respond_to
do
|
format
|
format
.
html
# show.html.erb
format
.
js
end
end
def
new
@team_member
=
project
.
users_projects
.
new
respond_to
do
|
format
|
format
.
html
# new.html.erb
format
.
js
end
end
def
create
@team_member
=
UsersProject
.
new
(
params
[
:team_member
])
@team_member
.
project
=
project
respond_to
do
|
format
|
if
@team_member
.
save
format
.
html
{
redirect_to
@team_member
,
notice:
'Team member was successfully created.'
}
format
.
js
else
format
.
html
{
render
action:
"new"
}
format
.
js
end
end
@team_member
.
save
end
def
update
...
...
@@ -45,7 +26,12 @@ class TeamMembersController < ApplicationController
respond_to
do
|
format
|
format
.
js
format
.
html
{
redirect_to
team_project_path
(
@project
)}
format
.
html
do
unless
@team_member
.
valid?
flash
[
:alert
]
=
"User should have at least one role"
end
redirect_to
team_project_path
(
@project
)
end
end
end
...
...
spec/requests/team_members_spec.rb
浏览文件 @
00290b92
...
...
@@ -29,19 +29,37 @@ describe "TeamMembers" do
describe
"fill in"
do
before
do
check
"team_member_read"
click_link
"Select user"
click_link
@user_1
.
name
#select @user_1.name, :from => "team_member_user_id"
within
"#team_member_new"
do
check
"team_member_read"
check
"team_member_write"
end
end
it
{
expect
{
click_button
"Save"
}.
to
change
{
UsersProject
.
count
}.
by
(
1
)
}
it
{
expect
{
click_button
"Save"
;
sleep
(
1
)
}.
to
change
{
UsersProject
.
count
}.
by
(
1
)
}
it
"should add new member to table"
do
click_button
"Save"
@member
=
UsersProject
.
last
page
.
should_not
have_content
(
"Add new member"
)
page
.
should
have_content
@user_1
.
name
@member
.
read
.
should
be_true
@member
.
write
.
should
be_true
@member
.
admin
.
should
be_false
end
it
"should not allow creation without access selected"
do
within
"#team_member_new"
do
uncheck
"team_member_read"
uncheck
"team_member_write"
uncheck
"team_member_admin"
end
expect
{
click_button
"Save"
}.
to_not
change
{
UsersProject
.
count
}
page
.
should
have_content
(
"Please choose at least one Role in the Access list"
)
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录