summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/parsers_spec.rb
blob: 9d6896b3cb4523edabeedcd2e24d8c794ccad9b5 (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'

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 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