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
7901fa47
Commit
7901fa47
authored
Mar 12, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update params to allow setting values to nil
Add specs for missing cases
parent
783126ea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb
...hql/mutations/incident_management/oncall_rotation/base.rb
+2
-2
ee/spec/graphql/mutations/incident_management/oncall_rotation/update_spec.rb
...ations/incident_management/oncall_rotation/update_spec.rb
+19
-0
No files found.
ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb
View file @
7901fa47
...
...
@@ -42,7 +42,7 @@ module Mutations
params
[
:participants
]
=
find_participants
(
participants
)
params
[
:starts_at
]
=
parse_datetime
(
schedule
,
args
[
:starts_at
])
if
args
[
:starts_at
]
params
[
:ends_at
]
=
parse_datetime
(
schedule
,
args
[
:ends_at
])
if
args
[
:ends_at
]
params
[
:ends_at
]
=
parse_datetime
(
schedule
,
args
[
:ends_at
])
if
args
.
key?
(
:ends_at
)
if
args
[
:rotation_length
]
params
.
merge!
(
...
...
@@ -51,7 +51,7 @@ module Mutations
)
end
if
args
[
:active_period
].
present?
if
args
.
key?
(
:active_period
)
active_period_start
,
active_period_end
=
active_period_times
(
args
)
params
.
merge!
(
active_period_start:
active_period_start
,
...
...
ee/spec/graphql/mutations/incident_management/oncall_rotation/update_spec.rb
View file @
7901fa47
...
...
@@ -85,6 +85,10 @@ RSpec.describe Mutations::IncidentManagement::OncallRotation::Update do
context
'when endsAt is nil'
do
let
(
:ends_at
)
{
nil
}
before
do
rotation
.
update!
(
ends_at:
Time
.
current
)
end
it
'returns the on-call rotation with no errors'
do
expect
(
resolve
[
:oncall_rotation
].
ends_at
).
to
be_nil
expect
(
resolve
[
:errors
]).
to
be_empty
...
...
@@ -165,6 +169,21 @@ RSpec.describe Mutations::IncidentManagement::OncallRotation::Update do
end
end
context
'removing active period'
do
before
do
rotation
.
update!
(
active_period_start:
"08:00"
,
active_period_end:
"17:00"
)
args
.
merge!
(
active_period:
nil
)
end
it
'removes the active period'
do
expect
(
resolve
[
:errors
]).
to
be_empty
expect
(
rotation
.
reload
.
active_period_start
).
to
eq
(
nil
)
expect
(
rotation
.
active_period_end
).
to
eq
(
nil
)
end
end
describe
'error cases'
do
context
'user cannot be found'
do
before
do
...
...
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