diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2019-04-03 08:42:12 +0200 |
---|---|---|
committer | rpereira2 <rpereira@gitlab.com> | 2019-04-05 02:12:33 +0530 |
commit | 4a0c8b4a9c25257d9f0addfbc603f2bac80b63db (patch) | |
tree | 598c4a83a907ad1af76b849bcdf83e96591ada00 /spec/controllers/projects/environments | |
parent | 1427ad4f5ce11d8327d9258eb3ffc62803c1a304 (diff) | |
download | gitlab-ce-4a0c8b4a9c25257d9f0addfbc603f2bac80b63db.tar.gz |
Make filter params specs more readable
Diffstat (limited to 'spec/controllers/projects/environments')
-rw-r--r-- | spec/controllers/projects/environments/prometheus_api_controller_spec.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/controllers/projects/environments/prometheus_api_controller_spec.rb b/spec/controllers/projects/environments/prometheus_api_controller_spec.rb index b1b68bb42d8..d9ff420b682 100644 --- a/spec/controllers/projects/environments/prometheus_api_controller_spec.rb +++ b/spec/controllers/projects/environments/prometheus_api_controller_spec.rb @@ -37,11 +37,13 @@ describe Projects::Environments::PrometheusApiController do expect(json_response).to eq(prometheus_json_body) end - it 'filters params' do - get :proxy, params: environment_params({ extra_param: 'dangerous value' }) + it 'filters unknown params' do + get :proxy, params: environment_params(unknown_param: 'value') - expect(Prometheus::ProxyService).to have_received(:new) - .with(environment, 'GET', 'query', ActionController::Parameters.new({ 'query' => '1' }).permit!) + params = ActionController::Parameters.new('query' => '1').permit! + expect(Prometheus::ProxyService) + .to have_received(:new) + .with(environment, 'GET', 'query', params) end end @@ -133,6 +135,6 @@ describe Projects::Environments::PrometheusApiController do project_id: project, proxy_path: 'query', query: '1' - }.reverse_merge(params) + }.merge(params) end end |