Commit c9253c3e authored by syasonik's avatar syasonik

Rubocop cleanup

parent 3d302879
...@@ -158,7 +158,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -158,7 +158,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
def metrics_dashboard def metrics_dashboard
render_403 and return unless Feature.enabled?(:environment_metrics_use_prometheus_endpoint, project) render_403 && return unless Feature.enabled?(:environment_metrics_use_prometheus_endpoint, project)
respond_to do |format| respond_to do |format|
format.json do format.json do
......
require 'spec_helper' require 'spec_helper'
describe MetricsDashboardProcessingService do describe MetricsDashboardProcessingService do
let(:project) { build(:project) } let(:project) { build(:project) }
let(:dashboard_yml) { YAML.load_file('spec/fixtures/services/metrics_dashboard_processing_service.yml') } let(:dashboard_yml) { YAML.load_file('spec/fixtures/services/metrics_dashboard_processing_service.yml') }
describe 'process' do describe 'process' do
...@@ -21,12 +21,11 @@ describe MetricsDashboardProcessingService do ...@@ -21,12 +21,11 @@ describe MetricsDashboardProcessingService do
let!(:project_metric) { create(:prometheus_metric, project: project) } let!(:project_metric) { create(:prometheus_metric, project: project) }
it 'includes project-specific metrics' do it 'includes project-specific metrics' do
project_metric_details = { project_metric_details = {
query_range: project_metric.query, query_range: project_metric.query,
unit: project_metric.unit, unit: project_metric.unit,
label: project_metric.legend, label: project_metric.legend,
metric_id: project_metric.id, metric_id: project_metric.id
} }
expect(all_metrics).to include project_metric_details expect(all_metrics).to include project_metric_details
...@@ -41,7 +40,7 @@ describe MetricsDashboardProcessingService do ...@@ -41,7 +40,7 @@ describe MetricsDashboardProcessingService do
end end
it 'orders groups by priority and panels by weight' do it 'orders groups by priority and panels by weight' do
expected_metrics_order = ['metric_b', 'metric_a2', 'metric_a1'] expected_metrics_order = %w('metric_b metric_a2 metric_a1')
actual_metrics_order = all_metrics.map { |m| m[:id] } actual_metrics_order = all_metrics.map { |m| m[:id] }
expect(actual_metrics_order).to eq expected_metrics_order expect(actual_metrics_order).to eq expected_metrics_order
......
require 'spec_helper' require 'spec_helper'
describe MetricsDashboardService, :use_clean_rails_memory_store_caching do describe MetricsDashboardService, :use_clean_rails_memory_store_caching do
let(:project) { build(:project) } let(:project) { build(:project) }
describe 'get_dashboard' do describe 'get_dashboard' do
it 'returns a json representation of the environment dashboard' do it 'returns a json representation of the environment dashboard' do
......
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