diff options
Diffstat (limited to 'spec/lib/gitlab/template')
-rw-r--r-- | spec/lib/gitlab/template/finders/global_template_finder_spec.rb | 19 | ||||
-rw-r--r-- | spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb | 6 |
2 files changed, 21 insertions, 4 deletions
diff --git a/spec/lib/gitlab/template/finders/global_template_finder_spec.rb b/spec/lib/gitlab/template/finders/global_template_finder_spec.rb index e776284b3e8..e2751d194d3 100644 --- a/spec/lib/gitlab/template/finders/global_template_finder_spec.rb +++ b/spec/lib/gitlab/template/finders/global_template_finder_spec.rb @@ -15,9 +15,9 @@ RSpec.describe Gitlab::Template::Finders::GlobalTemplateFinder do FileUtils.rm_rf(base_dir) end - subject(:finder) { described_class.new(base_dir, '', { 'General' => '', 'Bar' => 'Bar' }, exclusions: exclusions) } + subject(:finder) { described_class.new(base_dir, '', { 'General' => '', 'Bar' => 'Bar' }, excluded_patterns: excluded_patterns) } - let(:exclusions) { [] } + let(:excluded_patterns) { [] } describe '.find' do context 'with a non-prefixed General template' do @@ -38,7 +38,7 @@ RSpec.describe Gitlab::Template::Finders::GlobalTemplateFinder do end context 'while listed as an exclusion' do - let(:exclusions) { %w[test-template] } + let(:excluded_patterns) { [%r{^test-template$}] } it 'does not find the template without a prefix' do expect(finder.find('test-template')).to be_nil @@ -77,7 +77,7 @@ RSpec.describe Gitlab::Template::Finders::GlobalTemplateFinder do end context 'while listed as an exclusion' do - let(:exclusions) { %w[Bar/test-template] } + let(:excluded_patterns) { [%r{^Bar/test-template$}] } it 'does not find the template with a prefix' do expect(finder.find('Bar/test-template')).to be_nil @@ -96,6 +96,17 @@ RSpec.describe Gitlab::Template::Finders::GlobalTemplateFinder do expect(finder.find('Bar/test-template')).to be_nil end end + + context 'while listed as an exclusion' do + let(:excluded_patterns) { [%r{\.latest$}] } + + it 'excludes the template matched the pattern' do + create_template!('test-template.latest') + + expect(finder.find('test-template')).to be_present + expect(finder.find('test-template.latest')).to be_nil + end + end end end end diff --git a/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb b/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb index 55444114d39..26c83ed6793 100644 --- a/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb +++ b/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb @@ -13,6 +13,12 @@ RSpec.describe Gitlab::Template::GitlabCiYmlTemplate do expect(all).to include('Docker') expect(all).to include('Ruby') end + + it 'does not include Browser-Performance template in FOSS' do + all = subject.all.map(&:name) + + expect(all).not_to include('Browser-Performance') unless Gitlab.ee? + end end describe '#content' do |