Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
d07e85e1
Commit
d07e85e1
authored
May 23, 2017
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add-unicode-trace-feature-test' into 'master'
Add feature test with unicode trace See merge request !10736
parents
b9f07618
a74b7d90
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
42 deletions
+29
-42
changelogs/unreleased/add-unicode-trace-feature-test.yml
changelogs/unreleased/add-unicode-trace-feature-test.yml
+4
-0
spec/controllers/projects/builds_controller_spec.rb
spec/controllers/projects/builds_controller_spec.rb
+15
-42
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+10
-0
No files found.
changelogs/unreleased/add-unicode-trace-feature-test.yml
0 → 100644
View file @
d07e85e1
---
title
:
Add a feature test for Unicode trace
merge_request
:
10736
author
:
dosuken123
spec/controllers/projects/builds_controller_spec.rb
View file @
d07e85e1
...
...
@@ -144,6 +144,8 @@ describe Projects::BuildsController do
it
'returns a trace'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'id'
]).
to
eq
build
.
id
expect
(
json_response
[
'status'
]).
to
eq
build
.
status
expect
(
json_response
[
'html'
]).
to
eq
(
'BUILD TRACE'
)
end
end
...
...
@@ -153,10 +155,23 @@ describe Projects::BuildsController do
it
'returns no traces'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'id'
]).
to
eq
build
.
id
expect
(
json_response
[
'status'
]).
to
eq
build
.
status
expect
(
json_response
[
'html'
]).
to
be_nil
end
end
context
'when build has a trace with ANSI sequence and Unicode'
do
let
(
:build
)
{
create
(
:ci_build
,
:unicode_trace
,
pipeline:
pipeline
)
}
it
'returns a trace with Unicode'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'id'
]).
to
eq
build
.
id
expect
(
json_response
[
'status'
]).
to
eq
build
.
status
expect
(
json_response
[
'html'
]).
to
include
(
"ヾ(´༎ຶД༎ຶ`)ノ"
)
end
end
def
get_trace
get
:trace
,
namespace_id:
project
.
namespace
,
project_id:
project
,
...
...
@@ -185,48 +200,6 @@ describe Projects::BuildsController do
end
end
describe
'GET trace.json'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:user
)
{
create
(
:user
)
}
context
'when user is logged in as developer'
do
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
get_trace
end
it
'traces build log'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'id'
]).
to
eq
build
.
id
expect
(
json_response
[
'status'
]).
to
eq
build
.
status
end
end
context
'when user is logged in as non member'
do
before
do
sign_in
(
user
)
get_trace
end
it
'traces build log'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'id'
]).
to
eq
build
.
id
expect
(
json_response
[
'status'
]).
to
eq
build
.
status
end
end
def
get_trace
get
:trace
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
build
.
id
,
format: :json
end
end
describe
'POST retry'
do
before
do
project
.
add_developer
(
user
)
...
...
spec/factories/ci/builds.rb
View file @
d07e85e1
...
...
@@ -128,6 +128,16 @@ FactoryGirl.define do
end
end
trait
:unicode_trace
do
after
(
:create
)
do
|
build
,
evaluator
|
trace
=
File
.
binread
(
File
.
expand_path
(
Rails
.
root
.
join
(
'spec/fixtures/trace/ansi-sequence-and-unicode'
)))
build
.
trace
.
set
(
trace
)
end
end
trait
:erased
do
erased_at
Time
.
now
erased_by
factory: :user
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment