2018-06-04 11:41:37 +00:00
|
|
|
shared_examples 'file finder' do
|
|
|
|
let(:query) { 'files' }
|
|
|
|
let(:search_results) { subject.find(query) }
|
|
|
|
|
|
|
|
it 'finds by name' do
|
2018-12-02 21:47:33 +00:00
|
|
|
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-06-04 11:41:37 +00:00
|
|
|
expect(blob.ref).to eq(subject.ref)
|
|
|
|
expect(blob.data).not_to be_empty
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'finds by content' do
|
2018-12-02 21:47:33 +00:00
|
|
|
blob = search_results.find { |blob| blob.filename == expected_file_by_content }
|
2018-06-04 11:41:37 +00:00
|
|
|
|
2018-12-02 21:47:33 +00:00
|
|
|
expect(blob.filename).to eq(expected_file_by_content)
|
|
|
|
expect(blob).to be_a(Gitlab::Search::FoundBlob)
|
2018-06-04 11:41:37 +00:00
|
|
|
expect(blob.ref).to eq(subject.ref)
|
|
|
|
expect(blob.data).not_to be_empty
|
|
|
|
end
|
|
|
|
end
|