Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
5285e01d
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,发现更多精彩内容 >>
提交
5285e01d
编写于
9月 15, 2015
作者:
K
Kamil Trzcinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix: features/ci/runners_spec.rb
上级
9621f433
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
19 addition
and
12 deletion
+19
-12
app/controllers/ci/runner_projects_controller.rb
app/controllers/ci/runner_projects_controller.rb
+1
-1
app/models/user.rb
app/models/user.rb
+9
-0
spec/features/ci/runners_spec.rb
spec/features/ci/runners_spec.rb
+9
-11
未找到文件。
app/controllers/ci/runner_projects_controller.rb
浏览文件 @
5285e01d
...
...
@@ -9,7 +9,7 @@ module Ci
def
create
@runner
=
Ci
::
Runner
.
find
(
params
[
:runner_project
][
:runner_id
])
return
head
(
403
)
unless
current_user
.
authorized_runners
.
include?
(
@runner
)
return
head
(
403
)
unless
current_user
.
ci_
authorized_runners
.
include?
(
@runner
)
if
@runner
.
assign_to
(
project
,
current_user
)
redirect_to
ci_project_runners_path
(
project
)
...
...
app/models/user.rb
浏览文件 @
5285e01d
...
...
@@ -753,4 +753,13 @@ class User < ActiveRecord::Base
def
can_be_removed?
!
solo_owned_groups
.
present?
end
def
ci_authorized_projects
@ci_authorized_projects
||=
Ci
::
Project
.
where
(
gitlab_id:
authorized_projects
)
end
def
ci_authorized_runners
Ci
::
Runner
.
specific
.
includes
(
:runner_projects
).
where
(
ci_runner_projects:
{
project_id:
ci_authorized_projects
}
)
end
end
spec/features/ci/runners_spec.rb
浏览文件 @
5285e01d
require
'spec_helper'
describe
"Runners"
do
let
(
:user
)
{
create
(
:user
)
}
before
do
login_as
:user
login_as
(
user
)
end
describe
"specific runners"
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@project2
=
FactoryGirl
.
create
:ci_project
stub_js_gitlab_calls
@project
.
gl_project
.
team
<<
[
user
,
:master
]
# all projects should be authorized for user
allow_any_instance_of
(
Network
).
to
receive
(
:projects
).
and_return
([
OpenStruct
.
new
({
id:
@project
.
gitlab_id
}),
OpenStruct
.
new
({
id:
@project2
.
gitlab_id
})
])
@project2
=
FactoryGirl
.
create
:ci_project
@project2
.
gl_project
.
team
<<
[
user
,
:master
]
@shared_runner
=
FactoryGirl
.
create
:ci_shared_runner
@specific_runner
=
FactoryGirl
.
create
:ci_specific_runner
...
...
@@ -60,14 +58,14 @@ describe "Runners" do
click_on
"Remove runner"
end
expect
(
Runner
.
exists?
(
id:
@specific_runner
)).
to
be_falsey
expect
(
Ci
::
Runner
.
exists?
(
id:
@specific_runner
)).
to
be_falsey
end
end
describe
"shared runners"
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
stub_js_gitlab_calls
@project
.
gl_project
.
team
<<
[
user
,
:master
]
end
it
"enables shared runners"
do
...
...
@@ -82,7 +80,7 @@ describe "Runners" do
describe
"show page"
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
stub_js_gitlab_calls
@project
.
gl_project
.
team
<<
[
user
,
:master
]
@specific_runner
=
FactoryGirl
.
create
:ci_specific_runner
@project
.
runners
<<
@specific_runner
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录