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

lfs_pointers_finder_spec.rb « finders « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f45f383f2f98dc16cb7ac67dd7ca51ba86efe5e (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe LfsPointersFinder do
  subject(:finder) { described_class.new(repository, path) }

  let_it_be(:project) { create(:project, :repository) }
  let_it_be(:repository) { project.repository }

  let(:path) { nil }

  describe '#execute' do
    subject { finder.execute }

    let(:expected_blob_id) { '0c304a93cb8430108629bbbcaa27db3343299bc0' }

    context 'when path has no LFS files' do
      it { is_expected.to eq([]) }
    end

    context 'when path points to LFS file' do
      let(:path) { 'files/lfs/lfs_object.iso' }

      it 'returns LFS blob ids' do
        is_expected.to eq([expected_blob_id])
      end
    end

    context 'when path points to directory with LFS files' do
      let(:path) { 'files/lfs/' }

      it 'returns LFS blob ids' do
        is_expected.to eq([expected_blob_id])
      end
    end

    context 'when repository is empty' do
      let(:project) { create(:project, :empty_repo) }

      it { is_expected.to eq([]) }
    end
  end
end