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
4f565864
Commit
4f565864
authored
Mar 15, 2022
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for multiple images
parent
9dfc8b3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
ee/spec/services/ee/alert_management/create_alert_issue_service_spec.rb
...es/ee/alert_management/create_alert_issue_service_spec.rb
+15
-11
No files found.
ee/spec/services/ee/alert_management/create_alert_issue_service_spec.rb
View file @
4f565864
...
...
@@ -6,11 +6,8 @@ RSpec.describe AlertManagement::CreateAlertIssueService do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
group:
group
)
}
let_it_be
(
:alert
)
{
create
(
:alert_management_alert
,
project:
project
)
}
let
(
:created_issue
)
{
Issue
.
last!
}
describe
'#execute'
do
subject
(
:execute
)
{
described_class
.
new
(
alert
,
user
).
execute
}
...
...
@@ -21,18 +18,25 @@ RSpec.describe AlertManagement::CreateAlertIssueService do
it
'copies any metric images'
do
image
=
create
(
:alert_metric_image
,
alert:
alert
)
image_2
=
create
(
:alert_metric_image
,
alert:
alert
)
incident
=
execute
.
payload
[
:issue
]
ex
ecute
ex
pect
(
incident
.
metric_images
.
count
).
to
eq
(
2
)
incident
=
Issue
.
incident
.
last
first_metric_image
,
second_metric_image
=
incident
.
metric_images
.
order
(
:created_at
)
expect_image_matches
(
first_metric_image
,
image
)
expect_image_matches
(
second_metric_image
,
image_2
)
end
expect
(
incident
.
metric_images
.
count
).
to
eq
(
1
)
private
metric_image
=
incident
.
metric_images
.
first
expect
(
metric_image
.
url
).
to
eq
(
image
.
url
)
expect
(
metric_image
.
url_text
).
to
eq
(
image
.
url_text
)
expect
(
metric_image
.
filename
).
to
eq
(
image
.
filename
)
expect
(
metric_image
.
file
).
not_to
eq
(
image
.
file
)
def
expect_image_matches
(
image
,
image_expectation
)
expect
(
image
.
url
).
to
eq
(
image_expectation
.
url
)
expect
(
image
.
url_text
).
to
eq
(
image_expectation
.
url_text
)
expect
(
image
.
filename
).
to
eq
(
image_expectation
.
filename
)
expect
(
image
.
file
).
not_to
eq
(
image_expectation
.
file
)
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