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
dfc1a7c3
Commit
dfc1a7c3
authored
Aug 03, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec styling
parent
c0c0cd25
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
27 deletions
+55
-27
ee/spec/models/epic_spec.rb
ee/spec/models/epic_spec.rb
+1
-1
ee/spec/requests/api/epics_spec.rb
ee/spec/requests/api/epics_spec.rb
+3
-3
ee/spec/services/epic_issues/create_service_spec.rb
ee/spec/services/epic_issues/create_service_spec.rb
+1
-0
ee/spec/services/epic_issues/destroy_service_spec.rb
ee/spec/services/epic_issues/destroy_service_spec.rb
+1
-0
ee/spec/services/epics/update_service_spec.rb
ee/spec/services/epics/update_service_spec.rb
+8
-8
ee/spec/services/milestones/update_service_spec.rb
ee/spec/services/milestones/update_service_spec.rb
+13
-12
spec/factories/milestones.rb
spec/factories/milestones.rb
+5
-0
spec/services/milestones/update_service_spec.rb
spec/services/milestones/update_service_spec.rb
+23
-3
No files found.
ee/spec/models/epic_spec.rb
View file @
dfc1a7c3
...
...
@@ -344,7 +344,7 @@ describe Epic do
context
'query count check'
do
let
(
:milestone
)
{
create
(
:milestone
,
start_date:
Date
.
new
(
2000
,
1
,
1
),
due_date:
Date
.
new
(
2000
,
1
,
10
))
}
let!
(
:epics
)
{
[
create
(
:epic
)
]
}
let!
(
:epics
)
{
[
create
(
:epic
)
]
}
def
setup_control_group
link_epic_to_milestone
(
epics
[
0
],
milestone
)
...
...
ee/spec/requests/api/epics_spec.rb
View file @
dfc1a7c3
...
...
@@ -40,7 +40,7 @@ describe API::Epics do
end
end
shared_examples
'
admin_epic permission
'
do
shared_examples
'
can admin epics
'
do
let
(
:extra_date_fields
)
{
%w[start_date_is_fixed start_date_fixed due_date_is_fixed due_date_fixed]
}
context
'when permission is absent'
do
...
...
@@ -165,7 +165,7 @@ describe API::Epics do
expect_array_response
([
epic2
.
id
])
end
it_behaves_like
'
admin_epic permission
'
it_behaves_like
'
can admin epics
'
end
end
...
...
@@ -191,7 +191,7 @@ describe API::Epics do
expect
(
response
).
to
match_response_schema
(
'public_api/v4/epic'
,
dir:
'ee'
)
end
it_behaves_like
'
admin_epic permission
'
it_behaves_like
'
can admin epics
'
end
end
...
...
ee/spec/services/epic_issues/create_service_spec.rb
View file @
dfc1a7c3
...
...
@@ -272,6 +272,7 @@ describe EpicIssues::CreateService do
context
'refresh epic dates'
do
it
'calls epic#update_dates'
do
expect
(
epic
).
to
receive
(
:update_dates
)
assign_issue
([
valid_reference
])
end
end
...
...
ee/spec/services/epic_issues/destroy_service_spec.rb
View file @
dfc1a7c3
...
...
@@ -79,6 +79,7 @@ describe EpicIssues::DestroyService do
context
'refresh epic dates'
do
it
'calls epic#update_dates'
do
expect
(
epic
).
to
receive
(
:update_dates
)
subject
end
end
...
...
ee/spec/services/epics/update_service_spec.rb
View file @
dfc1a7c3
...
...
@@ -29,12 +29,11 @@ describe Epics::UpdateService do
update_epic
(
opts
)
expect
(
epic
).
to
be_valid
expect
(
epic
.
title
).
to
eq
(
opts
[
:title
])
expect
(
epic
.
description
).
to
eq
(
opts
[
:description
])
expect
(
epic
.
start_date_fixed
).
to
eq
(
Date
.
strptime
(
opts
[
:start_date_fixed
]))
expect
(
epic
.
start_date_is_fixed
).
to
eq
(
opts
[
:start_date_is_fixed
])
expect
(
epic
.
due_date_fixed
).
to
eq
(
Date
.
strptime
(
opts
[
:due_date_fixed
]))
expect
(
epic
.
due_date_is_fixed
).
to
eq
(
opts
[
:due_date_is_fixed
])
expect
(
epic
).
to
have_attributes
(
opts
.
except
(
:due_date_fixed
,
:start_date_fixed
))
expect
(
epic
).
to
have_attributes
(
start_date_fixed:
Date
.
strptime
(
opts
[
:start_date_fixed
]),
due_date_fixed:
Date
.
strptime
(
opts
[
:due_date_fixed
])
)
end
it
'updates the last_edited_at value'
do
...
...
@@ -125,8 +124,7 @@ describe Epics::UpdateService do
expect
{
update_epic
(
start_date:
Date
.
today
,
end_date:
Date
.
today
)
}.
not_to
change
{
Note
.
count
}
expect
(
epic
).
to
be_valid
expect
(
epic
.
start_date
).
to
eq
(
nil
)
expect
(
epic
.
due_date
).
to
eq
(
nil
)
expect
(
epic
).
to
have_attributes
(
start_date:
nil
,
due_date:
nil
)
end
end
...
...
@@ -134,6 +132,7 @@ describe Epics::UpdateService do
context
'date fields are updated'
do
it
'calls epic#update_dates'
do
expect
(
epic
).
to
receive
(
:update_dates
)
update_epic
(
start_date_is_fixed:
true
,
start_date_fixed:
Date
.
today
)
end
end
...
...
@@ -141,6 +140,7 @@ describe Epics::UpdateService do
context
'date fields are not updated'
do
it
'does not call epic#update_dates'
do
expect
(
epic
).
not_to
receive
(
:update_dates
)
update_epic
(
title:
'foo'
)
end
end
...
...
ee/spec/services/milestones/update_service_spec.rb
View file @
dfc1a7c3
...
...
@@ -2,25 +2,26 @@
require
'spec_helper'
describe
Milestones
::
UpdateService
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
build
(
:user
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
describe
'#execute'
do
context
'refresh related epic dates'
do
let
(
:epic
)
{
create
(
:epic
)
}
let!
(
:issue
)
{
create
(
:issue
,
milestone:
milestone
,
epic:
epic
)
}
let
(
:due_date
)
{
3
.
days
.
from_now
.
to_date
}
it
'calls epic#update_dates'
do
project
=
create
(
:project
)
user
=
build
(
:user
)
milestone
=
create
(
:milestone
,
project:
project
)
epic
=
create
(
:epic
)
create
(
:issue
,
milestone:
milestone
,
epic:
epic
)
due_date
=
3
.
days
.
from_now
.
to_date
described_class
.
new
(
project
,
user
,
{
due_date:
due_date
}).
execute
(
milestone
)
epic
.
reload
expect
(
epic
.
start_date
).
to
eq
(
nil
)
expect
(
epic
.
start_date_sourcing_milestone
).
to
eq
(
nil
)
expect
(
epic
.
due_date
).
to
eq
(
due_date
)
expect
(
epic
.
due_date_sourcing_milestone
).
to
eq
(
milestone
)
expect
(
epic
.
reload
).
to
have_attributes
(
start_date:
nil
,
start_date_sourcing_milestone:
nil
,
due_date:
due_date
,
due_date_sourcing_milestone:
milestone
)
end
end
end
...
...
spec/factories/milestones.rb
View file @
dfc1a7c3
...
...
@@ -18,6 +18,11 @@ FactoryBot.define do
state
"closed"
end
trait
:with_dates
do
start_date
{
Date
.
new
(
2000
,
1
,
1
)
}
due_date
{
Date
.
new
(
2000
,
1
,
30
)
}
end
after
(
:build
,
:stub
)
do
|
milestone
,
evaluator
|
if
evaluator
.
group
milestone
.
group
=
evaluator
.
group
...
...
spec/services/milestones/update_service_spec.rb
View file @
dfc1a7c3
...
...
@@ -8,14 +8,34 @@ describe Milestones::UpdateService do
describe
'#execute'
do
context
"valid params"
do
let
(
:inner_service
)
{
double
(
:service
)
}
before
do
project
.
add_maintainer
(
user
)
end
subject
{
described_class
.
new
(
project
,
user
,
{
title:
'new_title'
}).
execute
(
milestone
)
}
it
{
expect
(
subject
).
to
be_valid
}
it
{
expect
(
subject
.
title
).
to
eq
(
'new_title'
)
}
@milestone
=
described_class
.
new
(
project
,
user
,
{
title:
'new_title'
}).
execute
(
milestone
)
context
'state_event is activate'
do
it
'calls ReopenService'
do
expect
(
Milestones
::
ReopenService
).
to
receive
(
:new
).
with
(
project
,
user
,
{}).
and_return
(
inner_service
)
expect
(
inner_service
).
to
receive
(
:execute
).
with
(
milestone
)
described_class
.
new
(
project
,
user
,
{
state_event:
'activate'
}).
execute
(
milestone
)
end
end
it
{
expect
(
@milestone
).
to
be_valid
}
it
{
expect
(
@milestone
.
title
).
to
eq
(
'new_title'
)
}
context
'state_event is close'
do
it
'calls ReopenService'
do
expect
(
Milestones
::
CloseService
).
to
receive
(
:new
).
with
(
project
,
user
,
{}).
and_return
(
inner_service
)
expect
(
inner_service
).
to
receive
(
:execute
).
with
(
milestone
)
described_class
.
new
(
project
,
user
,
{
state_event:
'close'
}).
execute
(
milestone
)
end
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