gitlab-org--gitlab-foss/spec/lib/gitlab/ci/parsers_spec.rb

34 lines
789 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-08-03 07:13:27 -04:00
require 'spec_helper'
describe Gitlab::Ci::Parsers do
2018-08-03 07:13:27 -04:00
describe '.fabricate!' do
subject { described_class.fabricate!(file_type) }
context 'when file_type is junit' do
2018-08-03 07:13:27 -04:00
let(:file_type) { 'junit' }
it 'fabricates the class' do
is_expected.to be_a(described_class::Test::Junit)
2018-08-03 07:13:27 -04:00
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
2018-08-03 07:13:27 -04:00
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)
2018-08-03 07:13:27 -04:00
end
end
end
end