Test type of README file without extension
This commit is contained in:
parent
133c1a7cc3
commit
be0af5e69f
2 changed files with 4 additions and 3 deletions
|
@ -8,7 +8,7 @@ module Gitlab
|
||||||
module FileDetector
|
module FileDetector
|
||||||
PATTERNS = {
|
PATTERNS = {
|
||||||
# Project files
|
# Project files
|
||||||
readme: %r{\A(readme|index)[^\/]*\z}i,
|
readme: %r{\A(readme|index)[^/]*\z}i,
|
||||||
changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i,
|
changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i,
|
||||||
license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i,
|
license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i,
|
||||||
contributing: %r{\Acontributing[^/]*\z}i,
|
contributing: %r{\Acontributing[^/]*\z}i,
|
||||||
|
|
|
@ -15,8 +15,9 @@ describe Gitlab::FileDetector do
|
||||||
|
|
||||||
describe '.type_of' do
|
describe '.type_of' do
|
||||||
it 'returns the type of a README file' do
|
it 'returns the type of a README file' do
|
||||||
%w(README readme INDEX index).each do |filename|
|
%w[README readme INDEX index].each do |filename|
|
||||||
%w(.md .adoc).each do |extname|
|
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)
|
expect(described_class.type_of(filename + extname)).to eq(:readme)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue