File: lfs_pointers_finder_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (44 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download
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