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
939a94a9
Commit
939a94a9
authored
Sep 16, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move CoverageReports#index N+1 spec to controller file
parent
217bf817
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
ee/spec/controllers/groups/analytics/coverage_reports_controller_spec.rb
...lers/groups/analytics/coverage_reports_controller_spec.rb
+14
-0
ee/spec/finders/ci/daily_build_group_report_results_by_group_finder_spec.rb
.../daily_build_group_report_results_by_group_finder_spec.rb
+0
-11
No files found.
ee/spec/controllers/groups/analytics/coverage_reports_controller_spec.rb
View file @
939a94a9
...
...
@@ -110,6 +110,20 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
end
end
it
'executes the same number of queries regardless of the number of records returned'
do
control
=
ActiveRecord
::
QueryRecorder
.
new
do
get
:index
,
params:
valid_request_params
end
expect
(
CSV
.
parse
(
response
.
body
).
length
).
to
eq
(
3
)
create_daily_coverage
(
'rspec'
,
project
,
79.0
,
'2020-03-10'
)
expect
{
get
:index
,
params:
valid_request_params
}.
not_to
exceed_query_limit
(
control
)
expect
(
csv_response
.
length
).
to
eq
(
4
)
end
context
'with an invalid format'
do
it
'responds 404'
do
get
:index
,
params:
valid_request_params
.
merge
(
format: :json
)
...
...
ee/spec/finders/ci/daily_build_group_report_results_by_group_finder_spec.rb
View file @
939a94a9
...
...
@@ -99,17 +99,6 @@ RSpec.describe Ci::DailyBuildGroupReportResultsByGroupFinder do
expect
(
subject
).
to
match_array
([
rspec_project_coverage
,
karma_project_coverage
,
generic_coverage
])
end
end
context
'when accessing projects from the result'
do
it
'executes the same number of queries regardless of the number of records returned'
do
control
=
ActiveRecord
::
QueryRecorder
.
new
do
described_class
.
new
(
attributes
.
merge
(
limit:
1
)).
execute
.
map
(
&
:project
)
end
expect
{
subject
.
map
(
&
:project
)
}.
not_to
exceed_query_limit
(
control
)
expect
(
subject
).
to
match_array
([
rspec_project_coverage
,
karma_project_coverage
,
generic_coverage
])
end
end
end
context
'without permmissions'
do
...
...
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