blob: 18545698c2790f5d9fc95b654cabc4b102755261 (
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
25
26
27
28
29
|
# frozen_string_literal: true
RSpec.shared_examples 'search results filtered by language' do
let(:scope) { 'blobs' }
let(:filters) { { language: %w[Ruby Markdown] } }
let(:query) { 'def | popen | test' }
before do
project.repository.index_commits_and_blobs
ensure_elasticsearch_index!
end
subject(:blob_results) { results.objects('blobs') }
it 'filters by language', :sidekiq_inline, :aggregate_failures do
expected_paths = %w[
files/ruby/popen.rb
files/markdown/ruby-style-guide.md
files/ruby/regex.rb
files/ruby/version_info.rb
CONTRIBUTING.md
]
paths = blob_results.map { |blob| blob.binary_path }
expect(blob_results.size).to eq(5)
expect(paths).to match_array(expected_paths)
end
end
|