summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2019-06-10 09:05:16 +0100
committerPhil Hughes <me@iamphill.com>2019-06-10 09:05:44 +0100
commit522c01972c7f46dbe8a2cd7569784fa255997c91 (patch)
treeab726ad68410c1c69d12bf8dc2aa527f2a05bd20 /spec/lib
parent25420de654b5581ccf6254be769a5e031446eced (diff)
downloadgitlab-ce-522c01972c7f46dbe8a2cd7569784fa255997c91.tar.gz
Add LFS blob ID to GraphQL blob type
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/graphql/loaders/batch_commit_loader_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/gitlab/graphql/loaders/batch_commit_loader_spec.rb b/spec/lib/gitlab/graphql/loaders/batch_commit_loader_spec.rb
new file mode 100644
index 00000000000..0137b1029cd
--- /dev/null
+++ b/spec/lib/gitlab/graphql/loaders/batch_commit_loader_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe Gitlab::Graphql::Loaders::BatchCommitLoader 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