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

parsers_spec.rb « ci « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: db9a5775d9f1173a4a38ac00650eb39afdada947 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Ci::Parsers do
  describe '.fabricate!' do
    subject { described_class.fabricate!(file_type) }

    context 'when file_type is junit' do
      let(:file_type) { 'junit' }

      it 'fabricates the class' do
        is_expected.to be_a(described_class::Test::Junit)
      end
    end

    context 'when file_type is cobertura' do
      let(:file_type) { 'cobertura' }

      it 'fabricates the class' do
        is_expected.to be_a(described_class::Coverage::Cobertura)
      end
    end

    context 'when file_type is accessibility' do
      let(:file_type) { 'accessibility' }

      it 'fabricates the class' do
        is_expected.to be_a(described_class::Accessibility::Pa11y)
      end
    end

    context 'when file_type is terraform' do
      let(:file_type) { 'terraform' }

      it 'fabricates the class' do
        is_expected.to be_a(described_class::Terraform::Tfplan)
      end
    end

    context 'when file_type does not exist' do
      let(:file_type) { 'undefined' }

      it 'raises an error' do
        expect { subject }.to raise_error(Gitlab::Ci::Parsers::ParserNotFoundError)
      end
    end
  end
end