diff options
author | Robert Speicher <rspeicher@gmail.com> | 2020-05-21 18:34:03 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2020-05-21 18:58:29 +0300 |
commit | c56f3fc999e0672a885ce90b38856696baf0817f (patch) | |
tree | 4d30342a20cf38ba25d00196a986a5d9be89bb81 | |
parent | 4bc2b125a632031688f399d456d5a5dcd6e707f5 (diff) |
Add spec for remote_branches with env
-rw-r--r-- | ruby/spec/lib/gitlab/git/repository_mirroring_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ruby/spec/lib/gitlab/git/repository_mirroring_spec.rb b/ruby/spec/lib/gitlab/git/repository_mirroring_spec.rb index a0efc83f8..dca981717 100644 --- a/ruby/spec/lib/gitlab/git/repository_mirroring_spec.rb +++ b/ruby/spec/lib/gitlab/git/repository_mirroring_spec.rb @@ -6,8 +6,11 @@ describe Gitlab::Git::RepositoryMirroring do class FakeRepository include Gitlab::Git::RepositoryMirroring - def initialize(projects_stub) + attr_reader :rugged + + def initialize(projects_stub, rugged_instance = nil) @gitlab_projects = projects_stub + @rugged = rugged_instance end def gitlab_projects_error @@ -15,6 +18,26 @@ describe Gitlab::Git::RepositoryMirroring do end end + describe '#remote_branches' do + let(:projects_stub) { double.as_null_object } + let(:rugged_stub) { double.as_null_object } + + subject(:repository) { FakeRepository.new(projects_stub, rugged_stub) } + + it 'passes environment to `ls-remote`' do + env = { option_a: true, option_b: false } + + allow(repository).to receive(:feature_enabled?) + .with(:remote_branches_ls_remote) + .and_return(true) + expect(repository).to receive(:list_remote_refs) + .with('remote_a', env: env) + .and_return([]) + + repository.remote_branches('remote_a', env: env) + end + end + describe '#push_remote_branches' do let(:projects_stub) { double.as_null_object } |