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
Léo-Paul Géneau
gitlab-ce
Commits
eb5182ac
Commit
eb5182ac
authored
Jun 30, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group service spec.
parent
fdbf77ef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
spec/services/milestones/group_service_spec.rb
spec/services/milestones/group_service_spec.rb
+70
-0
No files found.
spec/services/milestones/group_service_spec.rb
0 → 100644
View file @
eb5182ac
require
'spec_helper'
describe
Milestones
::
GroupService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project1
)
{
create
(
:project
,
group:
group
)
}
let
(
:project2
)
{
create
(
:project
,
path:
'gitlab-ci'
,
group:
group
)
}
let
(
:project3
)
{
create
(
:project
,
path:
'cookbook-gitlab'
,
group:
group
)
}
let
(
:milestone1_project1
)
{
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project1
)
}
let
(
:milestone1_project2
)
{
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project2
)
}
let
(
:milestone1_project3
)
{
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project3
)
}
let
(
:milestone2_project1
)
{
create
(
:milestone
,
title:
"VD-123"
,
project:
project1
)
}
let
(
:milestone2_project2
)
{
create
(
:milestone
,
title:
"VD-123"
,
project:
project2
)
}
let
(
:milestone2_project3
)
{
create
(
:milestone
,
title:
"VD-123"
,
project:
project3
)
}
describe
'execute'
do
context
'with valid projects'
do
before
do
milestones
=
[
milestone1_project1
,
milestone1_project2
,
milestone1_project3
,
milestone2_project1
,
milestone2_project2
,
milestone2_project3
]
@group_milestones
=
Milestones
::
GroupService
.
new
(
milestones
).
execute
end
it
'should have all project milestones'
do
expect
(
@group_milestones
.
count
).
to
eq
(
2
)
end
it
'should have all project milestones titles'
do
expect
(
@group_milestones
.
map
{
|
group_milestone
|
group_milestone
.
title
}).
to
match_array
([
'Milestone v1.2'
,
'VD-123'
])
end
it
'should have all project milestones'
do
expect
(
@group_milestones
.
map
{
|
group_milestone
|
group_milestone
.
milestones
.
count
}.
sum
).
to
eq
(
6
)
end
end
end
describe
'milestone'
do
context
'with valid title'
do
before
do
milestones
=
[
milestone1_project1
,
milestone1_project2
,
milestone1_project3
,
milestone2_project1
,
milestone2_project2
,
milestone2_project3
]
@group_milestones
=
Milestones
::
GroupService
.
new
(
milestones
).
milestone
(
'Milestone v1.2'
)
end
it
'should have exactly one group milestone'
do
expect
(
@group_milestones
.
title
).
to
eq
(
'Milestone v1.2'
)
end
it
'should have all project milestones with the same title'
do
expect
(
@group_milestones
.
milestones
.
count
).
to
eq
(
3
)
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