Welcome to mirror list, hosted at ThFree Co, Russian Federation.

file_finder_shared_examples.rb « gitlab « lib « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dce927c875eb5ef9f9d87430c15aa8e214c53129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

RSpec.shared_examples 'file finder' do
  let(:query) { 'files' }
  let(:search_results) { subject.find(query) }

  it 'finds by path' do
    blob = search_results.find { |blob| blob.path == expected_file_by_path }

    expect(blob.path).to eq(expected_file_by_path)
    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.path == expected_file_by_content }

    expect(blob.path).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