2018-11-08 19:23:39 +05:30
|
|
|
shared_examples 'file finder' do
|
|
|
|
let(:query) { 'files' }
|
|
|
|
let(:search_results) { subject.find(query) }
|
|
|
|
|
|
|
|
it 'finds by name' do
|
2019-02-13 22:33:31 +05:30
|
|
|
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)
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(blob.ref).to eq(subject.ref)
|
|
|
|
expect(blob.data).not_to be_empty
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'finds by content' do
|
2019-02-13 22:33:31 +05:30
|
|
|
blob = search_results.find { |blob| blob.filename == expected_file_by_content }
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2019-02-13 22:33:31 +05:30
|
|
|
expect(blob.filename).to eq(expected_file_by_content)
|
|
|
|
expect(blob).to be_a(Gitlab::Search::FoundBlob)
|
2018-11-08 19:23:39 +05:30
|
|
|
expect(blob.ref).to eq(subject.ref)
|
|
|
|
expect(blob.data).not_to be_empty
|
|
|
|
end
|
|
|
|
end
|