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
b42b1b2b
Commit
b42b1b2b
authored
Sep 02, 2019
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract shared examples into a separate file
Extract incident processing shared examples from Notify services
parent
fa181833
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
48 deletions
+25
-48
ee/spec/services/projects/alerting/notify_service_spec.rb
ee/spec/services/projects/alerting/notify_service_spec.rb
+0
-24
ee/spec/services/projects/prometheus/alerts/notify_service_spec.rb
...ervices/projects/prometheus/alerts/notify_service_spec.rb
+0
-24
ee/spec/support/shared_examples/services/alerting.rb
ee/spec/support/shared_examples/services/alerting.rb
+25
-0
No files found.
ee/spec/services/projects/alerting/notify_service_spec.rb
View file @
b42b1b2b
...
...
@@ -10,30 +10,6 @@ describe Projects::Alerting::NotifyService do
project
.
clear_memoization
(
:licensed_feature_available
)
end
shared_examples
'processes incident issues'
do
|
amount
|
let
(
:create_incident_service
)
{
spy
}
it
'processes issues'
,
:sidekiq
do
expect
(
IncidentManagement
::
ProcessAlertWorker
)
.
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
kind_of
(
Hash
))
.
exactly
(
amount
).
times
Sidekiq
::
Testing
.
inline!
do
expect
(
subject
).
to
eq
(
true
)
end
end
end
shared_examples
'does not process incident issues'
do
it
'does not process issues'
do
expect
(
IncidentManagement
::
ProcessAlertWorker
)
.
not_to
receive
(
:perform_async
)
expect
(
subject
).
to
eq
(
true
)
end
end
describe
'#execute'
do
subject
{
service
.
execute
}
...
...
ee/spec/services/projects/prometheus/alerts/notify_service_spec.rb
View file @
b42b1b2b
...
...
@@ -29,30 +29,6 @@ describe Projects::Prometheus::Alerts::NotifyService do
end
end
shared_examples
'processes incident issues'
do
|
amount
|
let
(
:create_incident_service
)
{
spy
}
it
'processes issues'
,
:sidekiq
do
expect
(
IncidentManagement
::
ProcessAlertWorker
)
.
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
kind_of
(
Hash
))
.
exactly
(
amount
).
times
Sidekiq
::
Testing
.
inline!
do
expect
(
subject
).
to
eq
(
true
)
end
end
end
shared_examples
'does not process incident issues'
do
it
'does not process issues'
do
expect
(
IncidentManagement
::
ProcessAlertWorker
)
.
not_to
receive
(
:perform_async
)
expect
(
subject
).
to
eq
(
true
)
end
end
shared_examples
'persists events'
do
let
(
:create_events_service
)
{
spy
}
...
...
ee/spec/support/shared_examples/services/alerting.rb
0 → 100644
View file @
b42b1b2b
# frozen_string_literal: true
shared_examples
'processes incident issues'
do
|
amount
|
let
(
:create_incident_service
)
{
spy
}
it
'processes issues'
,
:sidekiq
do
expect
(
IncidentManagement
::
ProcessAlertWorker
)
.
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
kind_of
(
Hash
))
.
exactly
(
amount
).
times
Sidekiq
::
Testing
.
inline!
do
expect
(
subject
).
to
eq
(
true
)
end
end
end
shared_examples
'does not process incident issues'
do
it
'does not process issues'
do
expect
(
IncidentManagement
::
ProcessAlertWorker
)
.
not_to
receive
(
:perform_async
)
expect
(
subject
).
to
eq
(
true
)
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