debian-mirror-gitlab/spec/lib/gitlab/file_finder_spec.rb

32 lines
761 B
Ruby
Raw Normal View History

2017-09-10 17:25:29 +05:30
require 'spec_helper'
describe Gitlab::FileFinder do
describe '#find' do
let(:project) { create(:project, :public, :repository) }
2018-11-08 19:23:39 +05:30
subject { described_class.new(project, project.default_branch) }
2017-09-10 17:25:29 +05:30
2018-11-08 19:23:39 +05:30
it_behaves_like 'file finder' do
let(:expected_file_by_name) { 'files/images/wm.svg' }
let(:expected_file_by_content) { 'CHANGELOG' }
end
it 'filters by name' do
results = subject.find('files filename:wm.svg')
2018-03-17 18:26:18 +05:30
2018-11-08 19:23:39 +05:30
expect(results.count).to eq(1)
2017-09-10 17:25:29 +05:30
end
2018-11-08 19:23:39 +05:30
it 'filters by path' do
results = subject.find('white path:images')
expect(results.count).to eq(1)
end
2017-09-10 17:25:29 +05:30
2018-11-08 19:23:39 +05:30
it 'filters by extension' do
results = subject.find('files extension:svg')
2017-09-10 17:25:29 +05:30
2018-11-08 19:23:39 +05:30
expect(results.count).to eq(1)
2017-09-10 17:25:29 +05:30
end
end
end