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
6bb2573f
Commit
6bb2573f
authored
Jan 31, 2020
by
Robert May
Committed by
Rémy Coutable
Jan 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually increment the PageLimiter counter
parent
a033ad83
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
+24
-8
app/controllers/concerns/page_limiter.rb
app/controllers/concerns/page_limiter.rb
+1
-1
spec/controllers/concerns/page_limiter_spec.rb
spec/controllers/concerns/page_limiter_spec.rb
+15
-5
spec/controllers/explore/projects_controller_spec.rb
spec/controllers/explore/projects_controller_spec.rb
+8
-2
No files found.
app/controllers/concerns/page_limiter.rb
View file @
6bb2573f
...
...
@@ -63,6 +63,6 @@ module PageLimiter
controller:
params
[
:controller
],
action:
params
[
:action
],
bot:
dd
.
bot?
)
)
.
increment
end
end
spec/controllers/concerns/page_limiter_spec.rb
View file @
6bb2573f
...
...
@@ -71,19 +71,23 @@ describe PageLimiter do
describe
"#default_page_out_of_bounds_response"
do
subject
{
instance
.
send
(
:default_page_out_of_bounds_response
)
}
after
do
subject
end
it
"returns a bad_request header"
do
expect
(
instance
).
to
receive
(
:head
).
with
(
:bad_request
)
subject
end
end
describe
"#record_page_limit_interception"
do
subject
{
instance
.
send
(
:record_page_limit_interception
)
}
it
"records a metric counter"
do
let
(
:counter
)
{
double
(
"counter"
,
increment:
true
)
}
before
do
allow
(
Gitlab
::
Metrics
).
to
receive
(
:counter
)
{
counter
}
end
it
"creates a metric counter"
do
expect
(
Gitlab
::
Metrics
).
to
receive
(
:counter
).
with
(
:gitlab_page_out_of_bounds
,
controller:
"explore/projects"
,
...
...
@@ -93,5 +97,11 @@ describe PageLimiter do
subject
end
it
"increments the counter"
do
expect
(
counter
).
to
receive
(
:increment
)
subject
end
end
end
spec/controllers/explore/projects_controller_spec.rb
View file @
6bb2573f
...
...
@@ -90,8 +90,12 @@ describe Explore::ProjectsController do
end
describe
"metrics recording"
do
after
do
get
endpoint
,
params:
{
page:
page_limit
+
1
}
subject
{
get
endpoint
,
params:
{
page:
page_limit
+
1
}
}
let
(
:counter
)
{
double
(
"counter"
,
increment:
true
)
}
before
do
allow
(
Gitlab
::
Metrics
).
to
receive
(
:counter
)
{
counter
}
end
it
"records the interception"
do
...
...
@@ -101,6 +105,8 @@ describe Explore::ProjectsController do
action:
endpoint
.
to_s
,
bot:
false
)
subject
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