Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/metrics_dashboard_service_spec.rb')
-rw-r--r--spec/services/metrics_dashboard_service_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/services/metrics_dashboard_service_spec.rb b/spec/services/metrics_dashboard_service_spec.rb
new file mode 100644
index 00000000000..9b7994fa34f
--- /dev/null
+++ b/spec/services/metrics_dashboard_service_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe MetricsDashboardService, :use_clean_rails_memory_store_caching do
+ let(:project) { build(:project) }
+
+ describe 'get_dashboard' do
+ it 'returns a json representation of the environment dashboard' do
+ dashboard = described_class.new(project).get_dashboard
+ json = JSON.parse(dashboard, symbolize_names: true)
+
+ expect(json).to include(:dashboard, :order, :panel_groups)
+ expect(json[:panel_groups]).to all( include(:group, :priority, :panels) )
+ end
+
+ it 'caches the dashboard for subsequent calls' do
+ expect(YAML).to receive(:load_file).once.and_call_original
+
+ described_class.new(project).get_dashboard
+ described_class.new(project).get_dashboard
+ end
+ end
+end