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
c89fb511
Commit
c89fb511
authored
Dec 04, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak policy specs
- Add options to service description
parent
e09513fb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
14 deletions
+33
-14
ee/app/services/incident_management/oncall_rotations/create_service.rb
...es/incident_management/oncall_rotations/create_service.rb
+3
-3
ee/spec/policies/incident_management/oncall_rotation_policy_spec.rb
...licies/incident_management/oncall_rotation_policy_spec.rb
+17
-5
ee/spec/policies/incident_management/oncall_schedule_policy_spec.rb
...licies/incident_management/oncall_schedule_policy_spec.rb
+12
-5
ee/spec/services/incident_management/oncall_rotations/create_service_spec.rb
...cident_management/oncall_rotations/create_service_spec.rb
+1
-1
No files found.
ee/app/services/incident_management/oncall_rotations/create_service.rb
View file @
c89fb511
...
@@ -12,9 +12,9 @@ module IncidentManagement
...
@@ -12,9 +12,9 @@ module IncidentManagement
# @param params - length_unit [String] The unit of the rotation length. (One of 'hours', days', 'weeks')
# @param params - length_unit [String] The unit of the rotation length. (One of 'hours', days', 'weeks')
# @param params - starts_at [DateTime] The datetime the rotation starts on.
# @param params - starts_at [DateTime] The datetime the rotation starts on.
# @param params - participants [Array<hash>] An array of hashes defining participants of the on-call rotations.
# @param params - participants [Array<hash>] An array of hashes defining participants of the on-call rotations.
#
- participant [User] The user who is part of the rotation
#
@option opts
- participant [User] The user who is part of the rotation
#
- color_palette [String] The color palette to assign to the on-call user, for example: "blue".
#
@option opts
- color_palette [String] The color palette to assign to the on-call user, for example: "blue".
#
- color_weight [String] The color weight to assign to for the on-call user, for example "500". Max 4 chars.
#
@option opts
- color_weight [String] The color weight to assign to for the on-call user, for example "500". Max 4 chars.
def
initialize
(
schedule
,
project
,
user
,
params
)
def
initialize
(
schedule
,
project
,
user
,
params
)
@schedule
=
schedule
@schedule
=
schedule
@project
=
project
@project
=
project
...
...
ee/spec/policies/incident_management/oncall_rotation_policy_spec.rb
View file @
c89fb511
...
@@ -6,19 +6,31 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do
...
@@ -6,19 +6,31 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_schedule
,
project:
project
)
}
let_it_be
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_schedule
,
project:
project
)
}
let_it_be
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_rotation
,
oncall_schedule:
oncall_schedule
)
}
let_it_be
_with_refind
(
:oncall_rotation
)
{
create
(
:incident_management_oncall_rotation
,
oncall_schedule:
oncall_schedule
)
}
subject
(
:policy
)
{
described_class
.
new
(
user
,
oncall_schedule
)
}
subject
(
:policy
)
{
described_class
.
new
(
user
,
oncall_rotation
)
}
before
do
stub_feature_flags
(
oncall_schedules_mvc:
project
)
end
describe
'rules'
do
describe
'rules'
do
it
{
is_expected
.
to
be_disallowed
:read_incident_management_oncall_schedule
}
it
{
is_expected
.
to
be_disallowed
:read_incident_management_oncall_schedule
}
context
'when
maintain
er'
do
context
'when
report
er'
do
before
do
before
do
project
.
add_
maintain
er
(
user
)
project
.
add_
report
er
(
user
)
end
end
it
{
is_expected
.
to
be_allowed
:read_incident_management_oncall_schedule
}
it
{
is_expected
.
to
be_disallowed
:read_incident_management_oncall_schedule
}
context
'licensed feature enabled'
do
before
do
stub_licensed_features
(
oncall_schedules:
true
)
end
it
{
is_expected
.
to
be_allowed
:read_incident_management_oncall_schedule
}
end
end
end
end
end
end
end
ee/spec/policies/incident_management/oncall_schedule_policy_spec.rb
View file @
c89fb511
...
@@ -5,24 +5,31 @@ require 'spec_helper'
...
@@ -5,24 +5,31 @@ require 'spec_helper'
RSpec
.
describe
IncidentManagement
::
OncallSchedulePolicy
do
RSpec
.
describe
IncidentManagement
::
OncallSchedulePolicy
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_schedule
,
project:
project
)
}
let_it_be
_with_refind
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_schedule
,
project:
project
)
}
subject
(
:policy
)
{
described_class
.
new
(
user
,
oncall_schedule
)
}
subject
(
:policy
)
{
described_class
.
new
(
user
,
oncall_schedule
)
}
before
do
before
do
stub_licensed_features
(
oncall_schedules:
true
)
stub_feature_flags
(
oncall_schedules_mvc:
project
)
stub_feature_flags
(
oncall_schedules_mvc:
project
)
end
end
describe
'rules'
do
describe
'rules'
do
it
{
is_expected
.
to
be_disallowed
:read_incident_management_oncall_schedule
}
it
{
is_expected
.
to
be_disallowed
:read_incident_management_oncall_schedule
}
context
'when
maintain
er'
do
context
'when
report
er'
do
before
do
before
do
project
.
add_
maintain
er
(
user
)
project
.
add_
report
er
(
user
)
end
end
it
{
is_expected
.
to
be_allowed
:read_incident_management_oncall_schedule
}
it
{
is_expected
.
to
be_disallowed
:read_incident_management_oncall_schedule
}
context
'licensed feature enabled'
do
before
do
stub_licensed_features
(
oncall_schedules:
true
)
end
it
{
is_expected
.
to
be_allowed
:read_incident_management_oncall_schedule
}
end
end
end
end
end
end
end
ee/spec/services/incident_management/oncall_rotations/create_service_spec.rb
View file @
c89fb511
...
@@ -82,7 +82,7 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do
...
@@ -82,7 +82,7 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do
oncall_schedule
=
execute
.
payload
[
:oncall_rotation
]
oncall_schedule
=
execute
.
payload
[
:oncall_rotation
]
expect
(
oncall_schedule
).
to
be_a
(
::
IncidentManagement
::
OncallRotation
)
expect
(
oncall_schedule
).
to
be_a
(
::
IncidentManagement
::
OncallRotation
)
expect
(
oncall_schedule
.
name
).
to
eq
(
'On-call rotation'
)
expect
(
oncall_schedule
.
name
).
to
eq
(
'On-call rotation'
)
expect
(
oncall_schedule
.
length
).
to
eq
(
'1'
)
expect
(
oncall_schedule
.
length
).
to
eq
(
1
)
expect
(
oncall_schedule
.
length_unit
).
to
eq
(
'days'
)
expect
(
oncall_schedule
.
length_unit
).
to
eq
(
'days'
)
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