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

file_finder_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3fb6315a39a6b238bdf192ca3f640ffae3d8737b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'spec_helper'

describe Gitlab::FileFinder 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