diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-17 21:10:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-17 21:10:01 +0300 |
commit | 18da92341dac366b7bcfd13f2d3c443ffa315af0 (patch) | |
tree | 5189d9098a95d03d0b2b056f318a3637d9f547a7 /spec/lib/gitlab/file_finder_spec.rb | |
parent | 073ebdcae8630bbcc849f7cfb4c27fd81bef99a5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/file_finder_spec.rb')
-rw-r--r-- | spec/lib/gitlab/file_finder_spec.rb | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/spec/lib/gitlab/file_finder_spec.rb b/spec/lib/gitlab/file_finder_spec.rb index 36fb4c48fb2..8d6df62b3f6 100644 --- a/spec/lib/gitlab/file_finder_spec.rb +++ b/spec/lib/gitlab/file_finder_spec.rb @@ -13,22 +13,44 @@ RSpec.describe Gitlab::FileFinder do let(:expected_file_by_content) { 'CHANGELOG' } end - it 'filters by filename' do - results = subject.find('files filename:wm.svg') + context 'with inclusive filters' do + it 'filters by filename' do + results = subject.find('files filename:wm.svg') - expect(results.count).to eq(1) - end + expect(results.count).to eq(1) + end + + it 'filters by path' do + results = subject.find('white path:images') - it 'filters by path' do - results = subject.find('white path:images') + expect(results.count).to eq(1) + end - expect(results.count).to eq(1) + it 'filters by extension' do + results = subject.find('files extension:md') + + expect(results.count).to eq(4) + end end - it 'filters by extension' do - results = subject.find('files extension:svg') + context 'with exclusive filters' do + it 'filters by filename' do + results = subject.find('files -filename:wm.svg') + + expect(results.count).to eq(26) + end + + it 'filters by path' do + results = subject.find('white -path:images') + + expect(results.count).to eq(4) + end + + it 'filters by extension' do + results = subject.find('files -extension:md') - expect(results.count).to eq(1) + expect(results.count).to eq(23) + end end it 'does not cause N+1 query' do |