diff options
author | Steve Azzopardi <sazzopardi@gitlab.com> | 2018-11-16 14:52:59 +0300 |
---|---|---|
committer | Steve Azzopardi <sazzopardi@gitlab.com> | 2018-11-16 14:52:59 +0300 |
commit | 6ac06e95e1da99fd7d851a04fc96edf6b273d541 (patch) | |
tree | 0d854348c9eda274b877b18fa7354e6b2d1a34b7 /spec/lib | |
parent | 348dd42d797bafe2ffb64a2ed224c106726ea938 (diff) | |
parent | a4ae5411f5e75ca90f6172d8d03c6524f8efb8cb (diff) |
Merge branch '54011-all-files-named-index-have-their-content-rendered-as-if-they-were-text-files' into 'master'
Resolve "All files named `index.*` have their content rendered as if they were text files"
Closes #54011
See merge request gitlab-org/gitlab-ce!23063
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/file_detector_spec.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index edab53247e9..4ba9094b24e 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -15,14 +15,22 @@ describe Gitlab::FileDetector do describe '.type_of' do it 'returns the type of a README file' do - %w[README readme INDEX index].each do |filename| + filenames = Gitlab::MarkupHelper::PLAIN_FILENAMES + Gitlab::MarkupHelper::PLAIN_FILENAMES.map(&:upcase) + extensions = Gitlab::MarkupHelper::EXTENSIONS + Gitlab::MarkupHelper::EXTENSIONS.map(&:upcase) + + filenames.each do |filename| expect(described_class.type_of(filename)).to eq(:readme) - %w[.md .adoc .rst].each do |extname| - expect(described_class.type_of(filename + extname)).to eq(:readme) + + extensions.each do |extname| + expect(described_class.type_of("#{filename}.#{extname}")).to eq(:readme) end end end + it 'returns nil for a README.rb file' do + expect(described_class.type_of('README.rb')).to be_nil + end + it 'returns nil for a README file in a directory' do expect(described_class.type_of('foo/README.md')).to be_nil end |