diff options
author | Sean McGivern <sean@gitlab.com> | 2017-10-11 18:47:03 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-10-12 13:13:37 +0300 |
commit | 218e1f0963768fced0ed9a33762253c273c72069 (patch) | |
tree | 6ae59ba891b8291400820ec5cbd2f27b8b9cbc48 /spec/lib/gitlab/file_detector_spec.rb | |
parent | 90f95f2b8c25225bbd5601f9b8412931685d4bc0 (diff) |
Match full file path in FileDetector
The basename appears to have been a holdover from the past - it doesn't look
necessary now. Some of the regexes were unanchored on one side, so explicitly
ensure that they only match the root.
Apart from that, this means that pushing to foo/README.md will no longer
invalidate the main README cache for a project.
Diffstat (limited to 'spec/lib/gitlab/file_detector_spec.rb')
-rw-r--r-- | spec/lib/gitlab/file_detector_spec.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index 695fd6f8573..b5ac07c94fa 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -18,6 +18,10 @@ describe Gitlab::FileDetector do expect(described_class.type_of('README.md')).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 + it 'returns the type of a changelog file' do %w(CHANGELOG HISTORY CHANGES NEWS).each do |file| expect(described_class.type_of(file)).to eq(:changelog) |