gitlab-org--gitlab-foss/spec/lib/gitlab/file_finder_spec.rb

22 lines
579 B
Ruby
Raw Normal View History

2017-05-12 07:16:33 +00:00
require 'spec_helper'
describe Gitlab::FileFinder, lib: true do
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