debian-mirror-gitlab/spec/frontend/fixtures/metrics_dashboard.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.3 KiB
Ruby
Raw Normal View History

2020-04-08 14:13:33 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe MetricsDashboard, '(JavaScript fixtures)', type: :controller do
2020-04-08 14:13:33 +05:30
include JavaScriptFixturesHelpers
include MetricsDashboardHelpers
2020-07-28 23:09:34 +05:30
let_it_be(:user) { create(:user) }
2023-01-13 00:05:48 +05:30
let_it_be(:namespace) { create(:namespace, name: 'monitoring') }
2020-10-24 23:57:45 +05:30
let_it_be(:project) { project_with_dashboard_namespace('.gitlab/dashboards/test.yml', nil, namespace: namespace) }
2020-07-28 23:09:34 +05:30
let_it_be(:environment) { create(:environment, id: 1, project: project) }
let_it_be(:params) { { environment: environment } }
2020-04-08 14:13:33 +05:30
controller(::ApplicationController) do
include MetricsDashboard
end
before do
2023-07-09 08:55:56 +05:30
stub_feature_flags(remove_monitor_metrics: false)
2020-04-08 14:13:33 +05:30
sign_in(user)
project.add_maintainer(user)
allow(controller).to receive(:project).and_return(project)
2020-07-28 23:09:34 +05:30
allow(controller).to receive(:environment).and_return(environment)
2020-04-08 14:13:33 +05:30
allow(controller)
.to receive(:metrics_dashboard_params)
.and_return(params)
end
after do
remove_repository(project)
end
it 'metrics_dashboard/environment_metrics_dashboard.json' do
routes.draw { get "metrics_dashboard" => "anonymous#metrics_dashboard" }
2020-07-28 23:09:34 +05:30
2020-04-08 14:13:33 +05:30
response = get :metrics_dashboard, format: :json
2020-07-28 23:09:34 +05:30
2020-04-08 14:13:33 +05:30
expect(response).to be_successful
end
end