From cd94500a42dcdf381b3c67daa74e6e95b83c90b5 Mon Sep 17 00:00:00 2001 From: syasonik Date: Wed, 5 Jun 2019 16:10:29 +0100 Subject: [PATCH] Address rubocop errors --- lib/gitlab/metrics/dashboard/stages/endpoint_inserter.rb | 3 +-- spec/lib/gitlab/metrics/dashboard/processor_spec.rb | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/metrics/dashboard/stages/endpoint_inserter.rb b/lib/gitlab/metrics/dashboard/stages/endpoint_inserter.rb index 797df14b0e7..565fcde5c2c 100644 --- a/lib/gitlab/metrics/dashboard/stages/endpoint_inserter.rb +++ b/lib/gitlab/metrics/dashboard/stages/endpoint_inserter.rb @@ -16,8 +16,7 @@ module Gitlab private def endpoint_for_metric(metric) - Gitlab::Routing.url_helpers.prometheus_api_namespace_project_environment_path( - project.namespace, + Gitlab::Routing.url_helpers.prometheus_api_project_environment_path( project, environment, proxy_path: query_type(metric), diff --git a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb index f0256538c2e..8d0f237a78e 100644 --- a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb @@ -11,11 +11,14 @@ describe Gitlab::Metrics::Dashboard::Processor do let(:process_params) { [project, environment, dashboard_yml] } let(:dashboard) { described_class.new(*process_params).process(insert_project_metrics: true) } + # rubocop:disable RSpec/IteratedExpectation + # Cop disabled "all" matcher doesn't offer access to the element it 'includes a path for the prometheus endpoint with each metric' do all_metrics.each do |metric| expect(metric).to include(prometheus_endpoint_path: prometheus_path(metric[:query_range])) end end + # rubocop:enable RSpec/IteratedExpectation context 'when dashboard config corresponds to common metrics' do let!(:common_metric) { create(:prometheus_metric, :common, identifier: 'metric_a1') } @@ -114,6 +117,6 @@ describe Gitlab::Metrics::Dashboard::Processor do "/#{project.namespace.path}" \ "/#{project.name}/environments/" \ "#{environment.id}/prometheus/api/v1" \ - "/query_range?query=#{CGI::escape query}" + "/query_range?query=#{CGI.escape query}" end end