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
12b8516d
Commit
12b8516d
authored
Jun 14, 2021
by
Sean Arnold
Committed by
Stan Hu
Jun 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate multiple polices only on create
parent
a3c378f2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
ee/app/models/incident_management/escalation_policy.rb
ee/app/models/incident_management/escalation_policy.rb
+1
-1
ee/spec/models/incident_management/escalation_policy_spec.rb
ee/spec/models/incident_management/escalation_policy_spec.rb
+1
-1
No files found.
ee/app/models/incident_management/escalation_policy.rb
View file @
12b8516d
...
...
@@ -7,7 +7,7 @@ module IncidentManagement
belongs_to
:project
has_many
:rules
,
class_name:
'EscalationRule'
,
inverse_of: :policy
,
foreign_key:
'policy_id'
,
index_errors:
true
validates
:project_id
,
uniqueness:
{
message:
_
(
'can only have one escalation policy'
)
}
validates
:project_id
,
uniqueness:
{
message:
_
(
'can only have one escalation policy'
)
}
,
on: :create
validates
:name
,
presence:
true
,
uniqueness:
{
scope:
[
:project_id
]
},
length:
{
maximum:
72
}
validates
:description
,
length:
{
maximum:
160
}
validates
:rules
,
presence:
true
...
...
ee/spec/models/incident_management/escalation_policy_spec.rb
View file @
12b8516d
...
...
@@ -17,7 +17,7 @@ RSpec.describe IncidentManagement::EscalationPolicy do
describe
'validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:name
)
}
it
{
is_expected
.
to
validate_presence_of
(
:rules
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:project_id
).
with_message
(
/can only have one escalation policy/
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:project_id
).
with_message
(
/can only have one escalation policy/
)
.
on
(
:create
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:name
).
scoped_to
(
:project_id
)
}
it
{
is_expected
.
to
validate_length_of
(
:name
).
is_at_most
(
72
)
}
it
{
is_expected
.
to
validate_length_of
(
:description
).
is_at_most
(
160
)
}
...
...
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