gitlab-org--gitlab-foss/spec/support/shared_examples/file_finder.rb
Jan Provaznik 58bfd73331 Optimized file search to work without limits
* removed 100 limit on file search results because we
  load all results anyway
* expensive processing (parsing match content, utf encoding)
  is done only for selected page in paginated output
2018-12-06 09:25:09 +01:00

22 lines
715 B
Ruby

shared_examples 'file finder' do
let(:query) { 'files' }
let(:search_results) { subject.find(query) }
it 'finds by name' do
blob = search_results.find { |blob| blob.filename == expected_file_by_name }
expect(blob.filename).to eq(expected_file_by_name)
expect(blob).to be_a(Gitlab::Search::FoundBlob)
expect(blob.ref).to eq(subject.ref)
expect(blob.data).not_to be_empty
end
it 'finds by content' do
blob = search_results.find { |blob| blob.filename == expected_file_by_content }
expect(blob.filename).to eq(expected_file_by_content)
expect(blob).to be_a(Gitlab::Search::FoundBlob)
expect(blob.ref).to eq(subject.ref)
expect(blob.data).not_to be_empty
end
end