diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-04-19 15:44:05 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-05-20 13:46:02 +0200 |
commit | 4fa93d4dd4b2ebaa1ca0a34b2b5b2b4dd9730b9c (patch) | |
tree | 280cc762d87bdd47f56b87bc32010d5ea407a81c | |
parent | 712282cdcc4a97df23829284bfa031613bb05571 (diff) | |
download | gitlab-ce-enforce-template-uniqueness.tar.gz |
Ensure that template is used onceenforce-template-uniqueness
This adds additional test that make sure that each
template name is used exactly once across all folders
exposed
-rw-r--r-- | spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 fe46c67a920..5f0a7e925ca 100644 --- a/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb +++ b/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb @@ -15,6 +15,13 @@ describe Gitlab::Template::GitlabCiYmlTemplate do expect(all).to include('Docker') expect(all).to include('Ruby') end + + it 'ensure that the template name is used exactly once' do + all = subject.all.group_by(&:name) + duplicates = all.select { |_, templates| templates.length > 1 } + + expect(duplicates).to be_empty + end end describe '.find' do |