diff options
Diffstat (limited to 'spec/lib/gitlab/metrics/dashboard/processor_spec.rb')
-rw-r--r-- | spec/lib/gitlab/metrics/dashboard/processor_spec.rb | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb index 7250cefb9ff..7f7070dfafb 100644 --- a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb @@ -2,10 +2,12 @@ require 'spec_helper' -describe Gitlab::Metrics::Dashboard::Processor do +RSpec.describe Gitlab::Metrics::Dashboard::Processor do + include MetricsDashboardHelpers + let(:project) { build(:project) } let(:environment) { create(:environment, project: project) } - let(:dashboard_yml) { YAML.load_file('spec/fixtures/lib/gitlab/metrics/dashboard/sample_dashboard.yml') } + let(:dashboard_yml) { load_sample_dashboard } describe 'process' do let(:sequence) do @@ -13,7 +15,7 @@ describe Gitlab::Metrics::Dashboard::Processor do Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, Gitlab::Metrics::Dashboard::Stages::CustomMetricsInserter, Gitlab::Metrics::Dashboard::Stages::CustomMetricsDetailsInserter, - Gitlab::Metrics::Dashboard::Stages::EndpointInserter, + Gitlab::Metrics::Dashboard::Stages::MetricEndpointInserter, Gitlab::Metrics::Dashboard::Stages::Sorter, Gitlab::Metrics::Dashboard::Stages::AlertsInserter, Gitlab::Metrics::Dashboard::Stages::PanelIdsInserter, @@ -98,7 +100,7 @@ describe Gitlab::Metrics::Dashboard::Processor do let(:sequence) do [ Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, - Gitlab::Metrics::Dashboard::Stages::EndpointInserter, + Gitlab::Metrics::Dashboard::Stages::MetricEndpointInserter, Gitlab::Metrics::Dashboard::Stages::Sorter ] end @@ -202,27 +204,6 @@ describe Gitlab::Metrics::Dashboard::Processor do it_behaves_like 'errors with message', 'Each "metric" must define one of :query or :query_range' end - - describe 'validating links' do - context 'when the links contain a blocked url' do - let(:dashboard_yml_links) do - [{ 'url' => 'http://1.1.1.1.1' }, { 'url' => 'https://gitlab.com' }] - end - - let(:expected) do - [{ url: '' }, { url: 'https://gitlab.com' }] - end - - before do - stub_env('RSPEC_ALLOW_INVALID_URLS', 'false') - dashboard_yml['links'] = dashboard_yml_links - end - - it 'replaces the blocked url with an empty string' do - expect(dashboard[:links]).to eq(expected) - end - end - end end private |