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

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

describe Gitlab::Graphql::Loaders::BatchLfsOidLoader do
  include GraphqlHelpers

  set(:project) { create(:project, :repository) }
  let(:repository) { project.repository }
  let(:blob) { Gitlab::Graphql::Representation::TreeEntry.new(repository.blob_at('master', 'files/lfs/lfs_object.iso'), repository) }
  let(:otherblob) { Gitlab::Graphql::Representation::TreeEntry.new(repository.blob_at('master', 'README'), repository) }

  describe '#find' do
    it 'batch-resolves LFS blob IDs' do
      expect(Gitlab::Git::Blob).to receive(:batch_lfs_pointers).once.and_call_original

      result = batch do
        [blob, otherblob].map { |b| described_class.new(repository, b.id).find }
      end

      expect(result.first).to eq(blob.lfs_oid)
      expect(result.last).to eq(nil)
    end
  end
end