diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 15:07:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 15:07:43 +0300 |
commit | d10a462fedbd7794a83abdba9b4526600f71de5b (patch) | |
tree | 4dbd21cb89013d9e07b05bac5101cd13585a8be5 /spec/lib/gitlab/file_detector_spec.rb | |
parent | 13867d66e92c2fd8962a126db4fbdc32891343c9 (diff) |
Add latest changes from gitlab-org/gitlab@masterogolowinski-master-patch-80898
Diffstat (limited to 'spec/lib/gitlab/file_detector_spec.rb')
-rw-r--r-- | spec/lib/gitlab/file_detector_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index f3a9f706e86..23f7deba7f7 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -82,5 +82,21 @@ describe Gitlab::FileDetector do it 'returns nil for an unknown file' do expect(described_class.type_of('foo.txt')).to be_nil end + + it 'returns the type of an OpenAPI spec if file name is correct' do + openapi_types = [ + 'openapi.yml', 'openapi.yaml', 'openapi.json', + 'swagger.yml', 'swagger.yaml', 'swagger.json', + 'gitlab_swagger.yml', 'openapi_gitlab.yml', + 'OpenAPI.YML', 'openapi.Yaml', 'openapi.JSON', + 'openapi.gitlab.yml', 'gitlab.openapi.yml' + ] + + openapi_types.each do |type_name| + expect(described_class.type_of(type_name)).to eq(:openapi) + end + + expect(described_class.type_of('openapiyml')).to be_nil + end end end |