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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fa8052a4
Commit
fa8052a4
authored
Jan 09, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not show artifacts keep button if not allowed
parent
8ab94120
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
app/views/projects/builds/_sidebar.html.haml
app/views/projects/builds/_sidebar.html.haml
+1
-1
spec/features/projects/builds_spec.rb
spec/features/projects/builds_spec.rb
+21
-7
No files found.
app/views/projects/builds/_sidebar.html.haml
View file @
fa8052a4
...
...
@@ -29,7 +29,7 @@
-
if
@build
.
artifacts?
.btn-group.btn-group-justified
{
role: :group
}
-
if
@build
.
artifacts_expire_at
-
if
@build
.
artifacts_expire_at
&&
can?
(
current_user
,
:update_build
,
@build
)
=
link_to
keep_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'btn btn-sm btn-default'
,
method: :post
do
Keep
...
...
spec/features/projects/builds_spec.rb
View file @
fa8052a4
...
...
@@ -3,6 +3,7 @@ require 'tempfile'
feature
'Builds'
,
:feature
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user_access_level
)
{
:developer
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
...
...
@@ -14,7 +15,7 @@ feature 'Builds', :feature do
end
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
user_access_level
]
login_as
(
user
)
end
...
...
@@ -131,7 +132,9 @@ feature 'Builds', :feature do
context
'Artifacts expire date'
do
before
do
build
.
update_attributes
(
artifacts_file:
artifacts_file
,
artifacts_expire_at:
expire_at
)
build
.
update_attributes
(
artifacts_file:
artifacts_file
,
artifacts_expire_at:
expire_at
)
visit
namespace_project_build_path
(
project
.
namespace
,
project
,
build
)
end
...
...
@@ -146,12 +149,23 @@ feature 'Builds', :feature do
context
'when expire date is defined'
do
let
(
:expire_at
)
{
Time
.
now
+
7
.
days
}
it
'keeps artifacts when Keep button is clicke
d'
do
expect
(
page
).
to
have_content
'The artifacts will be removed'
click_link
'Keep
'
context
'when user has ability to update buil
d'
do
it
'keeps artifacts when keep button is clicked'
do
expect
(
page
).
to
have_content
'The artifacts will be removed
'
expect
(
page
).
not_to
have_link
'Keep'
expect
(
page
).
not_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'
end
end
context
'when user does not have ability to update build'
do
let
(
:user_access_level
)
{
:guest
}
it
'does not have keep button'
do
expect
(
page
).
to
have_no_link
'Keep'
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