2019-11-12 22:06:31 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-06 17:49:33 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe Gitlab::GitalyClient::BlobService do
|
2018-02-06 17:49:33 -05:00
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:storage_name) { project.repository_storage }
|
|
|
|
let(:relative_path) { project.disk_path + '.git' }
|
|
|
|
let(:repository) { project.repository }
|
|
|
|
let(:client) { described_class.new(repository) }
|
|
|
|
|
|
|
|
describe '#get_new_lfs_pointers' do
|
|
|
|
let(:revision) { 'master' }
|
|
|
|
let(:limit) { 5 }
|
2019-12-20 04:24:38 -05:00
|
|
|
let(:not_in) { %w[branch-a branch-b] }
|
2018-02-06 17:49:33 -05:00
|
|
|
let(:expected_params) do
|
|
|
|
{ revision: revision, limit: limit, not_in_refs: not_in, not_in_all: false }
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { client.get_new_lfs_pointers(revision, limit, not_in) }
|
|
|
|
|
|
|
|
it 'sends a get_new_lfs_pointers message' do
|
|
|
|
expect_any_instance_of(Gitaly::BlobService::Stub)
|
|
|
|
.to receive(:get_new_lfs_pointers)
|
|
|
|
.with(gitaly_request_with_params(expected_params), kind_of(Hash))
|
|
|
|
.and_return([])
|
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with not_in = :all' do
|
|
|
|
let(:not_in) { :all }
|
|
|
|
let(:expected_params) do
|
|
|
|
{ revision: revision, limit: limit, not_in_refs: [], not_in_all: true }
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sends the correct message' do
|
|
|
|
expect_any_instance_of(Gitaly::BlobService::Stub)
|
|
|
|
.to receive(:get_new_lfs_pointers)
|
|
|
|
.with(gitaly_request_with_params(expected_params), kind_of(Hash))
|
|
|
|
.and_return([])
|
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#get_all_lfs_pointers' do
|
2020-03-25 05:08:11 -04:00
|
|
|
subject { client.get_all_lfs_pointers }
|
2018-02-06 17:49:33 -05:00
|
|
|
|
|
|
|
it 'sends a get_all_lfs_pointers message' do
|
|
|
|
expect_any_instance_of(Gitaly::BlobService::Stub)
|
|
|
|
.to receive(:get_all_lfs_pointers)
|
2020-03-25 05:08:11 -04:00
|
|
|
.with(gitaly_request_with_params({}), kind_of(Hash))
|
2018-02-06 17:49:33 -05:00
|
|
|
.and_return([])
|
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|