Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1f608ac4
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,发现更多精彩内容 >>
未验证
提交
1f608ac4
编写于
6月 04, 2016
作者:
T
Tomasz Maczukin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove 'unscoped' from project builds selection
上级
9aca0a1f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
138 addition
and
34 deletion
+138
-34
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+1
-1
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+1
-1
spec/features/builds_spec.rb
spec/features/builds_spec.rb
+136
-32
未找到文件。
app/controllers/projects/artifacts_controller.rb
浏览文件 @
1f608ac4
...
@@ -37,7 +37,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
...
@@ -37,7 +37,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
private
private
def
build
def
build
@build
||=
project
.
builds
.
unscoped
.
find_by!
(
id:
params
[
:build_id
])
@build
||=
project
.
builds
.
find_by!
(
id:
params
[
:build_id
])
end
end
def
artifacts_file
def
artifacts_file
...
...
app/controllers/projects/builds_controller.rb
浏览文件 @
1f608ac4
...
@@ -81,7 +81,7 @@ class Projects::BuildsController < Projects::ApplicationController
...
@@ -81,7 +81,7 @@ class Projects::BuildsController < Projects::ApplicationController
private
private
def
build
def
build
@build
||=
project
.
builds
.
unscoped
.
find_by!
(
id:
params
[
:id
])
@build
||=
project
.
builds
.
find_by!
(
id:
params
[
:id
])
end
end
def
build_path
(
build
)
def
build_path
(
build
)
...
...
spec/features/builds_spec.rb
浏览文件 @
1f608ac4
...
@@ -7,6 +7,7 @@ describe "Builds" do
...
@@ -7,6 +7,7 @@ describe "Builds" do
login_as
(
:user
)
login_as
(
:user
)
@commit
=
FactoryGirl
.
create
:ci_commit
@commit
=
FactoryGirl
.
create
:ci_commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
@build2
=
FactoryGirl
.
create
:ci_build
@project
=
@commit
.
project
@project
=
@commit
.
project
@project
.
team
<<
[
@user
,
:developer
]
@project
.
team
<<
[
@user
,
:developer
]
end
end
...
@@ -66,13 +67,24 @@ describe "Builds" do
...
@@ -66,13 +67,24 @@ describe "Builds" do
end
end
describe
"GET /:project/builds/:id"
do
describe
"GET /:project/builds/:id"
do
before
do
context
"Build from project"
do
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
before
do
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
end
it
{
expect
(
page
.
status_code
).
to
eq
(
200
)
}
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
it
{
expect
(
page
).
to
have_content
@commit
.
git_commit_message
}
it
{
expect
(
page
).
to
have_content
@commit
.
git_author_name
}
end
end
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
context
"Build from other project"
do
it
{
expect
(
page
).
to
have_content
@commit
.
git_commit_message
}
before
do
it
{
expect
(
page
).
to
have_content
@commit
.
git_author_name
}
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build2
)
end
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
end
context
"Download artifacts"
do
context
"Download artifacts"
do
before
do
before
do
...
@@ -103,51 +115,143 @@ describe "Builds" do
...
@@ -103,51 +115,143 @@ describe "Builds" do
end
end
describe
"POST /:project/builds/:id/cancel"
do
describe
"POST /:project/builds/:id/cancel"
do
before
do
context
"Build from project"
do
@build
.
run!
before
do
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
@build
.
run!
click_link
"Cancel"
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
click_link
"Cancel"
end
it
{
expect
(
page
.
status_code
).
to
eq
(
200
)
}
it
{
expect
(
page
).
to
have_content
'canceled'
}
it
{
expect
(
page
).
to
have_content
'Retry'
}
end
end
it
{
expect
(
page
).
to
have_content
'canceled'
}
context
"Build from other project"
do
it
{
expect
(
page
).
to
have_content
'Retry'
}
before
do
@build
.
run!
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
page
.
driver
.
post
(
cancel_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build2
))
end
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
end
end
end
describe
"POST /:project/builds/:id/retry"
do
describe
"POST /:project/builds/:id/retry"
do
before
do
context
"Build from project"
do
@build
.
run!
before
do
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
@build
.
run!
click_link
"Cancel"
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
click_link
'Retry'
click_link
'Cancel'
click_link
'Retry'
end
it
{
expect
(
page
.
status_code
).
to
eq
(
200
)
}
it
{
expect
(
page
).
to
have_content
'pending'
}
it
{
expect
(
page
).
to
have_content
'Cancel'
}
end
end
it
{
expect
(
page
).
to
have_content
'pending'
}
context
"Build from other project"
do
it
{
expect
(
page
).
to
have_content
'Cancel'
}
before
do
@build
.
run!
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
click_link
'Cancel'
page
.
driver
.
post
(
retry_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build2
))
end
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
end
end
end
describe
"GET /:project/builds/:id/download"
do
describe
"GET /:project/builds/:id/download"
do
before
do
context
"Build from project"
do
@build
.
update_attributes
(
artifacts_file:
artifacts_file
)
before
do
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
@build
.
update_attributes
(
artifacts_file:
artifacts_file
)
page
.
within
(
'.artifacts'
)
{
click_link
'Download'
}
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
page
.
within
(
'.artifacts'
)
{
click_link
'Download'
}
end
it
{
expect
(
page
.
status_code
).
to
eq
(
200
)
}
it
{
expect
(
page
.
response_headers
[
'Content-Type'
]).
to
eq
(
artifacts_file
.
content_type
)
}
end
end
it
{
expect
(
page
.
response_headers
[
'Content-Type'
]).
to
eq
(
artifacts_file
.
content_type
)
}
context
"Build from other project"
do
before
do
@build2
.
update_attributes
(
artifacts_file:
artifacts_file
)
visit
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build2
)
end
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
end
end
end
describe
"GET /:project/builds/:id/raw"
do
describe
"GET /:project/builds/:id/raw"
do
before
do
context
"Build from project"
do
Capybara
.
current_session
.
driver
.
header
(
'X-Sendfile-Type'
,
'X-Sendfile'
)
before
do
@build
.
run!
Capybara
.
current_session
.
driver
.
header
(
'X-Sendfile-Type'
,
'X-Sendfile'
)
@build
.
trace
=
'BUILD TRACE'
@build
.
run!
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
@build
.
trace
=
'BUILD TRACE'
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
page
.
within
(
'.build-controls'
)
{
click_link
'Raw'
}
end
it
'sends the right headers'
do
expect
(
page
.
status_code
).
to
eq
(
200
)
expect
(
page
.
response_headers
[
'Content-Type'
]).
to
eq
(
'text/plain; charset=utf-8'
)
expect
(
page
.
response_headers
[
'X-Sendfile'
]).
to
eq
(
@build
.
path_to_trace
)
end
end
context
"Build from other project"
do
before
do
Capybara
.
current_session
.
driver
.
header
(
'X-Sendfile-Type'
,
'X-Sendfile'
)
@build2
.
run!
@build2
.
trace
=
'BUILD TRACE'
visit
raw_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build2
)
puts
page
.
status_code
puts
current_url
end
it
'sends the right headers'
do
expect
(
page
.
status_code
).
to
eq
(
404
)
end
end
end
describe
"GET /:project/builds/:id/trace.json"
do
context
"Build from project"
do
before
do
visit
trace_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
,
format: :json
)
end
it
{
expect
(
page
.
status_code
).
to
eq
(
200
)
}
end
context
"Build from other project"
do
before
do
visit
trace_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build2
,
format: :json
)
end
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
end
end
describe
"GET /:project/builds/:id/status"
do
context
"Build from project"
do
before
do
visit
status_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
end
it
{
expect
(
page
.
status_code
).
to
eq
(
200
)
}
end
end
it
'sends the right headers'
do
context
"Build from other project"
do
page
.
within
(
'.build-controls'
)
{
click_link
'Raw'
}
before
do
visit
status_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build2
)
end
expect
(
page
.
response_headers
[
'Content-Type'
]).
to
eq
(
'text/plain; charset=utf-8'
)
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
expect
(
page
.
response_headers
[
'X-Sendfile'
]).
to
eq
(
@build
.
path_to_trace
)
end
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录