diff options
Diffstat (limited to 'spec/lib/gitlab/metrics/dashboard/finder_spec.rb')
| -rw-r--r-- | spec/lib/gitlab/metrics/dashboard/finder_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb index 697bedf7362..2d3b61e61ce 100644 --- a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb @@ -44,6 +44,12 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi it_behaves_like 'valid dashboard service response' end + context 'when the self monitoring dashboard is specified' do + let(:dashboard_path) { self_monitoring_dashboard_path } + + it_behaves_like 'valid dashboard service response' + end + context 'when no dashboard is specified' do let(:service_call) { described_class.find(project, user, environment: environment) } @@ -152,5 +158,33 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi expect(all_dashboard_paths).to contain_exactly(system_dashboard, project_dashboard) end end + + context 'when the project is self monitoring' do + let(:self_monitoring_dashboard) do + { + path: self_monitoring_dashboard_path, + display_name: 'Default', + default: true, + system_dashboard: false + } + end + let(:dashboard_path) { '.gitlab/dashboards/test.yml' } + let(:project) { project_with_dashboard(dashboard_path) } + + before do + stub_application_setting(self_monitoring_project_id: project.id) + end + + it 'includes self monitoring and project dashboards' do + project_dashboard = { + path: dashboard_path, + display_name: 'test.yml', + default: false, + system_dashboard: false + } + + expect(all_dashboard_paths).to contain_exactly(self_monitoring_dashboard, project_dashboard) + end + end end end |
