Commit 4a0c8b4a authored by Peter Leitzen's avatar Peter Leitzen Committed by rpereira2

Make filter params specs more readable

parent 1427ad4f
...@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment