debian-mirror-gitlab/spec/support/shared_examples/file_finder.rb

25 lines
730 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
shared_examples 'file finder' do
let(:query) { 'files' }
let(:search_results) { subject.find(query) }
2019-12-26 22:10:19 +05:30
it 'finds by path' do
blob = search_results.find { |blob| blob.path == expected_file_by_path }
2019-02-15 15:39:39 +05:30
2019-12-26 22:10:19 +05:30
expect(blob.path).to eq(expected_file_by_path)
2019-02-15 15:39:39 +05:30
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-12-26 22:10:19 +05:30
blob = search_results.find { |blob| blob.path == expected_file_by_content }
2018-11-08 19:23:39 +05:30
2019-12-26 22:10:19 +05:30
expect(blob.path).to eq(expected_file_by_content)
2019-02-15 15:39:39 +05:30
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