diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2018-06-04 13:57:51 +0200 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-06-04 13:57:51 +0200 |
commit | 8ffcaf3b85fdf716ffeacf4e9d4c89b922de50b9 (patch) | |
tree | 2e6acfa369e3e659ef4c6afb9290ad122a8fea5c /spec/support/shared_examples/file_finder.rb | |
parent | 1841da16abe864b3dae19636fee9e9bbe9a01b56 (diff) | |
parent | 23ae072ba2d601a3639a32f5a29302c430106bb8 (diff) | |
download | gitlab-ce-11-0-stable-prepare-rc2.tar.gz |
Merge branch 'master' into 11-0-stable-prepare-rc211-0-stable-prepare-rc2
Diffstat (limited to 'spec/support/shared_examples/file_finder.rb')
-rw-r--r-- | spec/support/shared_examples/file_finder.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/shared_examples/file_finder.rb b/spec/support/shared_examples/file_finder.rb new file mode 100644 index 00000000000..ef144bdf61c --- /dev/null +++ b/spec/support/shared_examples/file_finder.rb @@ -0,0 +1,21 @@ +shared_examples 'file finder' do + let(:query) { 'files' } + let(:search_results) { subject.find(query) } + + it 'finds by name' do + filename, blob = search_results.find { |_, blob| blob.filename == expected_file_by_name } + expect(filename).to eq(expected_file_by_name) + expect(blob).to be_a(Gitlab::SearchResults::FoundBlob) + expect(blob.ref).to eq(subject.ref) + expect(blob.data).not_to be_empty + end + + it 'finds by content' do + filename, blob = search_results.find { |_, blob| blob.filename == expected_file_by_content } + + expect(filename).to eq(expected_file_by_content) + expect(blob).to be_a(Gitlab::SearchResults::FoundBlob) + expect(blob.ref).to eq(subject.ref) + expect(blob.data).not_to be_empty + end +end |