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
12b27d3e
Commit
12b27d3e
authored
Oct 20, 2020
by
Mathieu Parent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Packages::Debian::GetOrCreateIncomingService
parent
ae349032
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
app/services/packages/debian/get_or_create_incoming_service.rb
...ervices/packages/debian/get_or_create_incoming_service.rb
+11
-0
spec/services/packages/debian/get_or_create_incoming_service_spec.rb
...es/packages/debian/get_or_create_incoming_service_spec.rb
+36
-0
No files found.
app/services/packages/debian/get_or_create_incoming_service.rb
0 → 100644
View file @
12b27d3e
# frozen_string_literal: true
module
Packages
module
Debian
class
GetOrCreateIncomingService
<
::
Packages
::
CreatePackageService
def
execute
find_or_create_package!
(
:debian
,
name:
'incoming'
,
version:
nil
)
end
end
end
end
spec/services/packages/debian/get_or_create_incoming_service_spec.rb
0 → 100644
View file @
12b27d3e
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Packages
::
Debian
::
GetOrCreateIncomingService
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
subject
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
describe
'#execute'
do
subject
(
:package
)
{
service
.
execute
}
context
'run once'
do
it
'creates a new package'
,
:aggregate_failures
do
expect
(
package
).
to
be_valid
expect
(
package
.
project_id
).
to
eq
(
project
.
id
)
expect
(
package
.
creator_id
).
to
eq
(
user
.
id
)
expect
(
package
.
name
).
to
eq
(
'incoming'
)
expect
(
package
.
version
).
to
be_nil
expect
(
package
.
package_type
).
to
eq
(
'debian'
)
expect
(
package
.
debian_incoming?
).
to
be_truthy
end
it_behaves_like
'assigns the package creator'
end
context
'run twice'
do
let!
(
:package2
)
{
service
.
execute
}
it
'returns the same object'
do
expect
(
package2
.
id
).
to
eq
(
package
.
id
)
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