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
Boxiang Sun
gitlab-ce
Commits
e2e8ec60
Commit
e2e8ec60
authored
Aug 29, 2016
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs
parent
77295de4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+51
-0
No files found.
spec/models/ci/build_spec.rb
View file @
e2e8ec60
...
...
@@ -19,4 +19,55 @@ describe Ci::Build, models: true do
expect
(
build
.
trace
).
to
eq
(
test_trace
)
end
end
describe
'#has_trace_file?'
do
context
'when there is no trace'
do
it
{
expect
(
build
.
has_trace_file?
).
to
be_falsey
}
it
{
expect
(
build
.
trace
).
to
be_nil
}
end
context
'when there is a trace'
do
context
'when trace is stored in file'
do
before
do
build
.
trace
=
test_trace
build
.
save
end
it
{
expect
(
build
.
has_trace_file?
).
to
be_truthy
}
it
{
expect
(
build
.
trace
).
to
eq
(
test_trace
)
}
end
context
'when trace is stored in old file'
do
before
do
build
.
trace
=
test_trace
build
.
save
build
.
project
.
ci_id
=
999
build
.
project
.
save
FileUtils
.
mkdir_p
(
build
.
old_dir_to_trace
)
FileUtils
.
mv
(
build
.
path_to_trace
,
build
.
old_path_to_trace
)
end
it
{
expect
(
build
.
has_trace_file?
).
to
be_truthy
}
it
{
expect
(
build
.
trace
).
to
eq
(
test_trace
)
}
end
context
'when there is stored in DB'
do
class
Ci::Build
def
write_db_trace
=
(
trace
)
write_attribute
:trace
,
trace
end
end
before
do
build
.
write_db_trace
=
test_trace
build
.
save
end
it
{
expect
(
build
.
has_trace_file?
).
to
be_falsey
}
it
{
expect
(
build
.
trace
).
to
eq
(
test_trace
)
}
end
end
end
end
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