BigW Consortium Gitlab

util_spec.rb 1.16 KB
Newer Older
1 2 3 4 5 6 7 8
require 'spec_helper'

describe Gitlab::GitalyClient::Util do
  describe '.repository' do
    let(:repository_storage) { 'default' }
    let(:relative_path) { 'my/repo.git' }
    let(:gl_repository) { 'project-1' }
    let(:git_object_directory) { '.git/objects' }
9
    let(:git_alternate_object_directory) { ['/dir/one', '/dir/two'] }
10 11 12 13 14 15

    subject do
      described_class.repository(repository_storage, relative_path, gl_repository)
    end

    it 'creates a Gitaly::Repository with the given data' do
16
      allow(Gitlab::Git::Env).to receive(:[]).with('GIT_OBJECT_DIRECTORY_RELATIVE')
17
        .and_return(git_object_directory)
18
      allow(Gitlab::Git::Env).to receive(:[]).with('GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE')
19 20 21 22 23 24 25
        .and_return(git_alternate_object_directory)

      expect(subject).to be_a(Gitaly::Repository)
      expect(subject.storage_name).to eq(repository_storage)
      expect(subject.relative_path).to eq(relative_path)
      expect(subject.gl_repository).to eq(gl_repository)
      expect(subject.git_object_directory).to eq(git_object_directory)
26
      expect(subject.git_alternate_object_directories).to eq(git_alternate_object_directory)
27 28 29
    end
  end
end