gitlab-org--gitlab-foss/spec/lib/gitlab/ci/templates/templates_spec.rb
Sean McGivern 026896cca2 Merge branch 'require-all-templates-to-include-default-stages' into 'master'
Require all templates to use default stages

Closes #59992

See merge request gitlab-org/gitlab-ce!26954

(cherry picked from commit 39eb16aab2)

e0df05cf Require all templates to use default stages
2019-04-15 12:47:35 +02:00

34 lines
729 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe "CI YML Templates" do
using RSpec::Parameterized::TableSyntax
subject { Gitlab::Ci::YamlProcessor.new(content) }
where(:template_name) do
Gitlab::Template::GitlabCiYmlTemplate.all.map(&:full_name)
end
with_them do
let(:content) do
<<~EOS
include:
- template: #{template_name}
concrete_build_implemented_by_a_user:
stage: test
script: do something
EOS
end
it 'is valid' do
expect { subject }.not_to raise_error
end
it 'require default stages to be included' do
expect(subject.stages).to include(*Gitlab::Ci::Config::Entry::Stages.default)
end
end
end