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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
4a0c8b4a
Commit
4a0c8b4a
authored
5 years ago
by
Peter Leitzen
Committed by
rpereira2
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make filter params specs more readable
parent
1427ad4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
...s/projects/environments/prometheus_api_controller_spec.rb
+7
-5
No files found.
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
View file @
4a0c8b4a
...
@@ -37,11 +37,13 @@ describe Projects::Environments::PrometheusApiController do
...
@@ -37,11 +37,13 @@ describe Projects::Environments::PrometheusApiController do
expect
(
json_response
).
to
eq
(
prometheus_json_body
)
expect
(
json_response
).
to
eq
(
prometheus_json_body
)
end
end
it
'filters params'
do
it
'filters
unknown
params'
do
get
:proxy
,
params:
environment_params
(
{
extra_param:
'dangerous value'
}
)
get
:proxy
,
params:
environment_params
(
unknown_param:
'value'
)
expect
(
Prometheus
::
ProxyService
).
to
have_received
(
:new
)
params
=
ActionController
::
Parameters
.
new
(
'query'
=>
'1'
).
permit!
.
with
(
environment
,
'GET'
,
'query'
,
ActionController
::
Parameters
.
new
({
'query'
=>
'1'
}).
permit!
)
expect
(
Prometheus
::
ProxyService
)
.
to
have_received
(
:new
)
.
with
(
environment
,
'GET'
,
'query'
,
params
)
end
end
end
end
...
@@ -133,6 +135,6 @@ describe Projects::Environments::PrometheusApiController do
...
@@ -133,6 +135,6 @@ describe Projects::Environments::PrometheusApiController do
project_id:
project
,
project_id:
project
,
proxy_path:
'query'
,
proxy_path:
'query'
,
query:
'1'
query:
'1'
}.
reverse_
merge
(
params
)
}.
merge
(
params
)
end
end
end
end
This diff is collapsed.
Click to expand it.
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