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

metrics_dashboard_service_spec.rb « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b7994fa34f7c4d57ac5c238750887a62f971d81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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