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
99e12104
Commit
99e12104
authored
Oct 07, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add exceeded scope to Incident SLA
parent
4d8b02a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
ee/app/models/issuable_sla.rb
ee/app/models/issuable_sla.rb
+2
-0
ee/spec/models/issuable_sla_spec.rb
ee/spec/models/issuable_sla_spec.rb
+27
-0
No files found.
ee/app/models/issuable_sla.rb
View file @
99e12104
...
@@ -3,4 +3,6 @@
...
@@ -3,4 +3,6 @@
class
IssuableSla
<
ApplicationRecord
class
IssuableSla
<
ApplicationRecord
belongs_to
:issue
,
optional:
false
belongs_to
:issue
,
optional:
false
validates
:due_at
,
presence:
true
validates
:due_at
,
presence:
true
scope
:exceeded_for_issues
,
->
{
joins
(
:issue
).
merge
(
Issue
.
opened
).
where
(
'due_at < ?'
,
Time
.
current
)
}
end
end
ee/spec/models/issuable_sla_spec.rb
View file @
99e12104
...
@@ -10,4 +10,31 @@ RSpec.describe IssuableSla do
...
@@ -10,4 +10,31 @@ RSpec.describe IssuableSla do
describe
'validations'
do
describe
'validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:due_at
)
}
it
{
is_expected
.
to
validate_presence_of
(
:due_at
)
}
end
end
describe
'scopes'
do
describe
'.exceeded_for_issues'
do
subject
{
described_class
.
exceeded_for_issues
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let!
(
:issuable_sla
)
{
create
(
:issuable_sla
,
issue:
issue
,
due_at:
due_at
)
}
let
(
:due_at
)
{
Time
.
current
-
1
.
hour
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
context
'issue closed'
do
let
(
:issue
)
{
create
(
:issue
,
:closed
,
project:
project
)
}
it
{
is_expected
.
to
be_empty
}
end
context
'issue opened'
do
context
'due_at has not passed'
do
let
(
:due_at
)
{
Time
.
current
+
1
.
hour
}
it
{
is_expected
.
to
be_empty
}
end
it
{
is_expected
.
to
contain_exactly
(
issuable_sla
)
}
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