Commit 6b6b779a authored by Justin Ho's avatar Justin Ho

Add shared context to prometheus_custom_metrics_spec

parent 76627f8a
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
describe 'Prometheus custom metrics', :js do describe 'Prometheus custom metrics', :js do
include PrometheusHelpers include PrometheusHelpers
let(:project) { create(:project) } include_context 'project service activation'
let(:user) { create(:user) }
let!(:prometheus_metric) { create(:prometheus_metric, project: project) } let!(:prometheus_metric) { create(:prometheus_metric, project: project) }
around do |example| around do |example|
...@@ -14,30 +14,18 @@ describe 'Prometheus custom metrics', :js do ...@@ -14,30 +14,18 @@ describe 'Prometheus custom metrics', :js do
end end
before do before do
project.add_maintainer(user)
sign_in(user)
visit(project_settings_integrations_path(project))
click_link('Prometheus')
stub_request(:get, prometheus_query_with_time_url('avg(metric)', Time.now.utc)) stub_request(:get, prometheus_query_with_time_url('avg(metric)', Time.now.utc))
create(:prometheus_service, project: project, api_url: 'http://prometheus.example.com', manual_configuration: '1', active: true) create(:prometheus_service, project: project, api_url: 'http://prometheus.example.com', manual_configuration: '1', active: true)
click_link('Prometheus') visit_project_integration('Prometheus')
end end
it 'Deletes a custom metric' do it 'deletes a custom metric' do
wait_for_requests
first('.custom-metric-link-bold').click first('.custom-metric-link-bold').click
click_button('Delete') click_button('Delete')
click_button('Delete metric') click_button('Delete metric')
wait_for_requests
expect(all('.custom-metric-link-bold').count).to eq(0) expect(all('.custom-metric-link-bold').count).to eq(0)
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