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
Léo-Paul Géneau
gitlab-ce
Commits
c850ceec
Commit
c850ceec
authored
Feb 02, 2016
by
Grzegorz Bizon
Committed by
Grzegorz Bizon
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create method that checks if build has been erased
+ minor improvements
parent
433de7ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
6 deletions
+23
-6
app/models/ci/build/eraseable.rb
app/models/ci/build/eraseable.rb
+6
-4
features/steps/project/builds/summary.rb
features/steps/project/builds/summary.rb
+1
-1
spec/models/ci/build/eraseable_spec.rb
spec/models/ci/build/eraseable_spec.rb
+16
-1
No files found.
app/models/ci/build/eraseable.rb
View file @
c850ceec
...
@@ -26,16 +26,18 @@ module Ci
...
@@ -26,16 +26,18 @@ module Ci
end
end
end
end
def
erased?
!
self
.
erased_at
.
nil?
end
private
private
def
erase_trace!
def
erase_trace!
File
.
truncate
(
path_to_trace
,
0
)
if
File
.
file?
(
path_to_trace
)
self
.
trace
=
nil
end
end
def
update_erased!
(
user
=
nil
)
def
update_erased!
(
user
=
nil
)
self
.
erased_by
=
user
if
user
self
.
update
(
erased_by:
user
,
erased_at:
Time
.
now
)
self
.
erased_at
=
Time
.
now
self
.
save!
end
end
end
end
end
end
...
...
features/steps/project/builds/summary.rb
View file @
c850ceec
...
@@ -18,7 +18,7 @@ class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps
...
@@ -18,7 +18,7 @@ class Spinach::Features::ProjectBuildsSummary < Spinach::FeatureSteps
step
'recent build has been erased'
do
step
'recent build has been erased'
do
expect
(
@build
.
artifacts_file
.
exists?
).
to
be_falsy
expect
(
@build
.
artifacts_file
.
exists?
).
to
be_falsy
expect
(
@build
.
artifacts_metadata
.
exists?
).
to
be_falsy
expect
(
@build
.
artifacts_metadata
.
exists?
).
to
be_falsy
expect
(
File
.
zero?
(
@build
.
path_to_trace
)).
to
be
true
expect
(
@build
.
trace
).
to
be_empty
end
end
step
'recent build summary does not have artifacts widget'
do
step
'recent build summary does not have artifacts widget'
do
...
...
spec/models/ci/build/eraseable_spec.rb
View file @
c850ceec
...
@@ -11,7 +11,7 @@ describe Ci::Build::Eraseable, models: true do
...
@@ -11,7 +11,7 @@ describe Ci::Build::Eraseable, models: true do
end
end
it
'should erase build trace in trace file'
do
it
'should erase build trace in trace file'
do
expect
(
File
.
zero?
(
build
.
path_to_trace
)).
to
eq
true
expect
(
build
.
trace
).
to
be_empty
end
end
it
'should set erased to true'
do
it
'should set erased to true'
do
...
@@ -78,6 +78,21 @@ describe Ci::Build::Eraseable, models: true do
...
@@ -78,6 +78,21 @@ describe Ci::Build::Eraseable, models: true do
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
end
end
describe
'#erased?'
do
let!
(
:build
)
{
create
(
:ci_build_with_trace
,
:success
,
:artifacts
)
}
subject
{
build
.
erased?
}
context
'build has not been erased'
do
it
{
is_expected
.
to
be
false
}
end
context
'build has been erased'
do
before
{
build
.
erase!
}
it
{
is_expected
.
to
be
true
}
end
end
context
'metadata and build trace are not available'
do
context
'metadata and build trace are not available'
do
let!
(
:build
)
{
create
(
:ci_build
,
:success
,
:artifacts
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:success
,
:artifacts
)
}
before
{
build
.
remove_artifacts_metadata!
}
before
{
build
.
remove_artifacts_metadata!
}
...
...
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