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
4abd67ff
Commit
4abd67ff
authored
Feb 17, 2021
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sanity checks for CSV data
parent
701f57aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
spec/services/issues/export_csv_service_spec.rb
spec/services/issues/export_csv_service_spec.rb
+18
-2
No files found.
spec/services/issues/export_csv_service_spec.rb
View file @
4abd67ff
...
...
@@ -60,6 +60,10 @@ RSpec.describe Issues::ExportCsvService do
expect
(
csv
.
headers
).
to
include
(
'Title'
,
'Description'
)
end
it
'returns two issues'
do
expect
(
csv
.
count
).
to
eq
(
2
)
end
specify
'iid'
do
expect
(
csv
[
0
][
'Issue ID'
]).
to
eq
issue
.
iid
.
to_s
end
...
...
@@ -163,12 +167,24 @@ RSpec.describe Issues::ExportCsvService do
end
end
context
'performance'
do
context
'with label links'
do
let
(
:labeled_issues
)
{
create_list
(
:labeled_issue
,
2
,
project:
project
,
author:
user
,
labels:
[
feature_label
,
idea_label
])
}
it
'does not run a query for each label link'
do
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
csv
}.
count
create_list
(
:labeled_issue
,
2
,
project:
project
,
author:
user
,
labels:
[
feature_label
,
idea_label
])
labeled_issues
expect
{
csv
}.
not_to
exceed_query_limit
(
control_count
)
expect
(
csv
.
count
).
to
eq
(
4
)
end
it
'returns the labels in sorted order'
do
labeled_issues
labeled_rows
=
csv
.
select
{
|
entry
|
labeled_issues
.
map
(
&
:iid
).
include?
(
entry
[
'Issue ID'
].
to_i
)
}
expect
(
labeled_rows
.
count
).
to
eq
(
2
)
expect
(
labeled_rows
.
map
{
|
entry
|
entry
[
'Labels'
]
}).
to
all
(
eq
(
"Feature,Idea"
)
)
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