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

client_spec.rb « validator « dashboard « metrics « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4b07f9dbbab73ed22be616cc314abb57c34f0629 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Metrics::Dashboard::Validator::Client do
  include MetricsDashboardHelpers

  let_it_be(:schema_path) { 'lib/gitlab/metrics/dashboard/validator/schemas/dashboard.json' }

  subject { described_class.new(dashboard, schema_path) }

  describe '#execute' do
    context 'with no validation errors' do
      let(:dashboard) { load_sample_dashboard }

      it 'returns empty array' do
        expect(subject.execute).to eq([])
      end
    end

    context 'with validation errors' do
      let(:dashboard) { load_dashboard_yaml(fixture_file('lib/gitlab/metrics/dashboard/invalid_dashboard.yml')) }

      it 'returns array of error objects' do
        expect(subject.execute).to include(Gitlab::Metrics::Dashboard::Validator::Errors::SchemaValidationError)
      end
    end
  end
end