2017-05-12 03:16:33 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Gitlab::FileFinder do
|
2017-05-12 03:16:33 -04:00
|
|
|
describe '#find' do
|
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:finder) { described_class.new(project, project.default_branch) }
|
|
|
|
|
|
|
|
it 'finds by name' do
|
|
|
|
results = finder.find('files')
|
|
|
|
expect(results.map(&:first)).to include('files/images/wm.svg')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'finds by content' do
|
|
|
|
results = finder.find('files')
|
|
|
|
|
|
|
|
blob = results.select { |result| result.first == "CHANGELOG" }.flatten.last
|
|
|
|
|
|
|
|
expect(blob.filename).to eq("CHANGELOG")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|