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
Jérome Perrin
gitlab-ce
Commits
e4f3d05c
Commit
e4f3d05c
authored
Nov 23, 2015
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for (Create|Update)ReleaseService
parent
091b879c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
spec/services/create_release_service_spec.rb
spec/services/create_release_service_spec.rb
+34
-0
spec/services/update_release_service_spec.rb
spec/services/update_release_service_spec.rb
+34
-0
No files found.
spec/services/create_release_service_spec.rb
0 → 100644
View file @
e4f3d05c
require
'spec_helper'
describe
CreateReleaseService
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:description
)
{
'Awesome release!'
}
let
(
:service
)
{
CreateReleaseService
.
new
(
project
,
user
)
}
it
'creates a new release'
do
result
=
service
.
execute
(
tag_name
,
description
)
expect
(
result
[
:status
]).
to
eq
(
:success
)
release
=
project
.
releases
.
find_by
(
tag:
tag_name
)
expect
(
release
).
not_to
be_nil
expect
(
release
.
description
).
to
eq
(
description
)
end
it
'raises an error if the tag does not exist'
do
result
=
service
.
execute
(
"foobar"
,
description
)
expect
(
result
[
:status
]).
to
eq
(
:error
)
end
context
'there already exists a release on a tag'
do
before
do
service
.
execute
(
tag_name
,
description
)
end
it
'raises an error and does not update the release'
do
result
=
service
.
execute
(
tag_name
,
'The best release!'
)
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
project
.
releases
.
find_by
(
tag:
tag_name
).
description
).
to
eq
(
description
)
end
end
end
spec/services/update_release_service_spec.rb
0 → 100644
View file @
e4f3d05c
require
'spec_helper'
describe
UpdateReleaseService
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:description
)
{
'Awesome release!'
}
let
(
:new_description
)
{
'The best release!'
}
let
(
:service
)
{
UpdateReleaseService
.
new
(
project
,
user
)
}
context
'with an existing release'
do
let
(
:create_service
)
{
CreateReleaseService
.
new
(
project
,
user
)
}
before
do
create_service
.
execute
(
tag_name
,
description
)
end
it
'successfully updates an existing release'
do
result
=
service
.
execute
(
tag_name
,
new_description
)
expect
(
result
[
:status
]).
to
eq
(
:success
)
expect
(
project
.
releases
.
find_by
(
tag:
tag_name
).
description
).
to
eq
(
new_description
)
end
end
it
'raises an error if the tag does not exist'
do
result
=
service
.
execute
(
"foobar"
,
description
)
expect
(
result
[
:status
]).
to
eq
(
:error
)
end
it
'raises an error if the release does not exist'
do
result
=
service
.
execute
(
tag_name
,
description
)
expect
(
result
[
:status
]).
to
eq
(
:error
)
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