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

snowplow_schema_validation_spec.rb « tracking « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 32c601ae47ddc6cd015570963a312988e50ecbec (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
30
31
32
33
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Snowplow Schema Validation' do
  context 'snowplow events definition' do
    shared_examples 'matches schema' do
      it 'conforms schema json' do
        paths = Dir[Rails.root.join(yaml_path)]

        events = paths.each_with_object([]) do |path, metrics|
          metrics.push(
            YAML.safe_load(File.read(path), aliases: true)
          )
        end

        expect(events).to all match_schema(Rails.root.join('config/events/schema.json'))
      end
    end

    describe 'matches the schema for CE' do
      let(:yaml_path) { 'config/events/*.yml' }

      it_behaves_like 'matches schema'
    end

    describe 'matches the schema for EE' do
      let(:yaml_path) { 'ee/config/events/*.yml' }

      it_behaves_like 'matches schema'
    end
  end
end