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
313e35e8
Commit
313e35e8
authored
Mar 29, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove container images destroy service class
parent
3bfc05be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
55 deletions
+0
-55
app/services/container_images/destroy_service.rb
app/services/container_images/destroy_service.rb
+0
-9
spec/services/container_images/destroy_service_spec.rb
spec/services/container_images/destroy_service_spec.rb
+0
-46
No files found.
app/services/container_images/destroy_service.rb
deleted
100644 → 0
View file @
3bfc05be
module
ContainerImages
class
DestroyService
<
BaseService
def
execute
(
container_image
)
return
false
unless
can?
(
current_user
,
:update_container_image
,
project
)
container_image
.
destroy!
end
end
end
spec/services/container_images/destroy_service_spec.rb
deleted
100644 → 0
View file @
3bfc05be
require
'spec_helper'
describe
ContainerImages
::
DestroyService
,
'#execute'
,
:services
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:container_repository
)
do
create
(
:container_repository
,
name:
'myimage'
,
tags:
%w[latest]
)
end
let
(
:project
)
do
create
(
:project
,
path:
'test'
,
namespace:
user
.
namespace
,
container_repositories:
[
container_repository
])
end
before
do
stub_container_registry_config
(
enabled:
true
)
end
it
{
expect
(
container_repository
).
to
be_valid
}
it
{
expect
(
project
.
container_repositories
).
not_to
be_empty
}
context
'when container image has tags'
do
before
do
project
.
add_master
(
user
)
end
it
'removes all tags before destroy'
do
service
=
described_class
.
new
(
project
,
user
)
expect
(
container_repository
)
.
to
receive
(
:delete_tags
).
and_return
(
true
)
expect
{
service
.
execute
(
container_repository
)
}
.
to
change
(
project
.
container_repositories
,
:count
).
by
(
-
1
)
end
it
'fails when tags are not removed'
do
service
=
described_class
.
new
(
project
,
user
)
expect
(
container_repository
)
.
to
receive
(
:delete_tags
).
and_return
(
false
)
expect
{
service
.
execute
(
container_repository
)
}
.
to
raise_error
(
ActiveRecord
::
RecordNotDestroyed
)
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