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>2021-05-19 18:44:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /spec/models/repository_spec.rb
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r--spec/models/repository_spec.rb61
1 files changed, 54 insertions, 7 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index a739f523008..7748846f6a5 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -1006,19 +1006,58 @@ RSpec.describe Repository do
end
end
- context 'when specifying a path with wildcard' do
- let(:path) { 'files/*/*.png' }
+ context 'when specifying a wildcard path' do
+ let(:path) { '*.md' }
+
+ it 'returns files matching the path in the root folder' do
+ expect(result).to contain_exactly('CONTRIBUTING.md',
+ 'MAINTENANCE.md',
+ 'PROCESS.md',
+ 'README.md')
+ end
+ end
+
+ context 'when specifying a wildcard path for all' do
+ let(:path) { '**.md' }
+
+ it 'returns all matching files in all folders' do
+ expect(result).to contain_exactly('CONTRIBUTING.md',
+ 'MAINTENANCE.md',
+ 'PROCESS.md',
+ 'README.md',
+ 'files/markdown/ruby-style-guide.md',
+ 'with space/README.md')
+ end
+ end
+
+ context 'when specifying a path to subfolders using two asterisks and a slash' do
+ let(:path) { 'files/**/*.md' }
it 'returns all files matching the path' do
- expect(result).to contain_exactly('files/images/logo-black.png',
- 'files/images/logo-white.png')
+ expect(result).to contain_exactly('files/markdown/ruby-style-guide.md')
+ end
+ end
+
+ context 'when specifying a wildcard path to subfolder with just two asterisks' do
+ let(:path) { 'files/**.md' }
+
+ it 'returns all files in the matching path' do
+ expect(result).to contain_exactly('files/markdown/ruby-style-guide.md')
+ end
+ end
+
+ context 'when specifying a wildcard path to subfolder with one asterisk' do
+ let(:path) { 'files/*/*.md' }
+
+ it 'returns all files in the matching path' do
+ expect(result).to contain_exactly('files/markdown/ruby-style-guide.md')
end
end
- context 'when specifying an extension with wildcard' do
- let(:path) { '*.rb' }
+ context 'when specifying a wildcard path for an unknown number of subfolder levels' do
+ let(:path) { '**/*.rb' }
- it 'returns all files matching the extension' do
+ it 'returns all matched files in all subfolders' do
expect(result).to contain_exactly('encoding/russian.rb',
'files/ruby/popen.rb',
'files/ruby/regex.rb',
@@ -1026,6 +1065,14 @@ RSpec.describe Repository do
end
end
+ context 'when specifying a wildcard path to one level of subfolders' do
+ let(:path) { '*/*.rb' }
+
+ it 'returns all matched files in one subfolder' do
+ expect(result).to contain_exactly('encoding/russian.rb')
+ end
+ end
+
context 'when sending regexp' do
let(:path) { '.*\.rb' }