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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
60e0137c
Commit
60e0137c
authored
Jun 14, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
278a0e1a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
24 deletions
+28
-24
lib/api/builds.rb
lib/api/builds.rb
+1
-1
spec/features/builds_spec.rb
spec/features/builds_spec.rb
+5
-11
spec/models/build_spec.rb
spec/models/build_spec.rb
+4
-2
spec/workers/expire_build_artifacts_worker_spec.rb
spec/workers/expire_build_artifacts_worker_spec.rb
+18
-10
No files found.
lib/api/builds.rb
View file @
60e0137c
...
...
@@ -184,7 +184,7 @@ module API
status
200
present
build
,
with:
Entities
::
Build
,
user_can_download_artifacts:
can?
(
current_user
,
:read_build
,
user_project
)
user_can_download_artifacts:
can?
(
current_user
,
:read_build
,
user_project
)
end
end
...
...
spec/features/builds_spec.rb
View file @
60e0137c
...
...
@@ -107,9 +107,7 @@ describe "Builds" do
let
(
:expire_at
)
{
nil
}
it
'does not have the Keep button'
do
page
.
within
(
'.artifacts'
)
do
expect
(
page
).
not_to
have_content
'Keep'
end
expect
(
page
).
not_to
have_content
'Keep'
end
end
...
...
@@ -117,10 +115,8 @@ describe "Builds" do
let
(
:expire_at
)
{
Time
.
now
+
7
.
days
}
it
'keeps artifacts when Keep button is clicked'
do
page
.
within
(
'.artifacts'
)
do
expect
(
page
).
to
have_content
'The artifacts will be removed'
click_link
'Keep'
end
expect
(
page
).
to
have_content
'The artifacts will be removed'
click_link
'Keep'
expect
(
page
).
not_to
have_link
'Keep'
expect
(
page
).
not_to
have_content
'The artifacts will be removed'
...
...
@@ -131,10 +127,8 @@ describe "Builds" do
let
(
:expire_at
)
{
Time
.
now
-
7
.
days
}
it
'does not have the Keep button'
do
page
.
within
(
'.artifacts'
)
do
expect
(
page
).
to
have_content
'The artifacts were removed'
expect
(
page
).
not_to
have_link
'Keep'
end
expect
(
page
).
to
have_content
'The artifacts were removed'
expect
(
page
).
not_to
have_link
'Keep'
end
end
end
...
...
spec/models/build_spec.rb
View file @
60e0137c
...
...
@@ -415,12 +415,14 @@ describe Ci::Build, models: true do
context
'is expired'
do
before
{
build
.
update
(
artifacts_expire_at:
Time
.
now
-
7
.
days
)
}
it
{
is_expected
.
to
be_falsy
}
it
{
is_expected
.
to
be_truthy
}
end
context
'is not expired'
do
before
{
build
.
update
(
artifacts_expire_at:
Time
.
now
+
7
.
days
)
}
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_falsey
}
end
end
...
...
spec/workers/expire_build_artifacts_worker_spec.rb
View file @
60e0137c
...
...
@@ -11,37 +11,45 @@ describe ExpireBuildArtifactsWorker do
subject!
{
worker
.
perform
}
context
'with expired artifacts'
do
let
!
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_expire_at:
Time
.
now
-
7
.
days
)
}
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_expire_at:
Time
.
now
-
7
.
days
)
}
it
'does expire'
do
expect
(
build
.
reload
.
artifacts_expired?
).
to
be_truthy
end
it
'does remove files'
do
expect
(
build
.
reload
.
artifacts_file
.
exists?
).
to
be_falsey
end
end
context
'with not yet expired artifacts'
do
let
!
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_expire_at:
Time
.
now
+
7
.
days
)
}
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_expire_at:
Time
.
now
+
7
.
days
)
}
it
'does not expire'
do
expect
(
build
.
reload
.
artifacts_expired?
).
to
be_truthy
expect
(
build
.
reload
.
artifacts_expired?
).
to
be_falsey
end
it
'does not remove files'
do
expect
(
build
.
reload
.
artifacts_file
.
exists?
).
to
be_truthy
end
end
context
'without expire date'
do
let
!
(
:build
)
{
create
(
:ci_build
,
:artifacts
)
}
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
)
}
it
'does not expire'
do
expect
(
build
.
reload
.
artifacts_expired?
).
to
be_falsey
end
it
'does not remove files'
do
expect
(
build
.
reload
.
artifacts_file
.
exists?
).
to
be_truthy
end
end
context
'for expired artifacts'
do
let
!
(
:build
)
{
create
(
:ci_build
,
artifacts_expire_at:
Time
.
now
-
7
.
days
)
}
let
(
:build
)
{
create
(
:ci_build
,
artifacts_expire_at:
Time
.
now
-
7
.
days
)
}
it
'does not erase artifacts'
do
expect_any_instance_of
(
Ci
::
Build
).
not_to
have_received
(
:erase_artifacts!
)
end
it
'does expire'
do
it
'is still expired'
do
expect
(
build
.
reload
.
artifacts_expired?
).
to
be_truthy
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