Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-13 06:07:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-13 06:07:51 +0300
commitb8e30b446d9cb91b94d2b55e5c81303c8f2d1b25 (patch)
treea68cf61f2840805d943d94b32ecbb6535119d1cb /spec/lib/gitlab/file_detector_spec.rb
parent01226c755d607c39e102dcac4b0c292c416c2aeb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/file_detector_spec.rb')
-rw-r--r--spec/lib/gitlab/file_detector_spec.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb
index 23f7deba7f7..3972bd24e80 100644
--- a/spec/lib/gitlab/file_detector_spec.rb
+++ b/spec/lib/gitlab/file_detector_spec.rb
@@ -16,23 +16,30 @@ describe Gitlab::FileDetector do
end
describe '.type_of' do
- it 'returns the type of a README file' do
- filenames = Gitlab::MarkupHelper::PLAIN_FILENAMES + Gitlab::MarkupHelper::PLAIN_FILENAMES.map(&:upcase)
- extensions = Gitlab::MarkupHelper::EXTENSIONS + Gitlab::MarkupHelper::EXTENSIONS.map(&:upcase)
+ it 'returns the type of a README without extension' do
+ expect(described_class.type_of('README')).to eq(:readme)
+ expect(described_class.type_of('INDEX')).to eq(:readme)
+ end
- filenames.each do |filename|
- expect(described_class.type_of(filename)).to eq(:readme)
+ it 'returns the type of a README file with a recognized extension' do
+ extensions = ['txt', *Gitlab::MarkupHelper::EXTENSIONS]
- extensions.each do |extname|
- expect(described_class.type_of("#{filename}.#{extname}")).to eq(:readme)
+ extensions.each do |ext|
+ %w(index readme).each do |file|
+ expect(described_class.type_of("#{file}.#{ext}")).to eq(:readme)
end
end
end
- it 'returns nil for a README.rb file' do
+ it 'returns nil for a README with unrecognized extension' do
expect(described_class.type_of('README.rb')).to be_nil
end
+ it 'is case insensitive' do
+ expect(described_class.type_of('ReadMe')).to eq(:readme)
+ expect(described_class.type_of('index.TXT')).to eq(:readme)
+ end
+
it 'returns nil for a README file in a directory' do
expect(described_class.type_of('foo/README.md')).to be_nil
end