diff options
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 9 | ||||
-rw-r--r-- | spec/lib/gitlab/gitaly_client/ref_service_spec.rb | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index d9d95e22e3b..50736d353ad 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -939,16 +939,21 @@ describe Gitlab::Git::Repository, seed_helper: true do context 'with deleted branch with Gitaly disabled' do before do allow(Gitlab::GitalyClient).to receive(:feature_enabled?).and_return(false) + end + + it 'returns no results' do ref = double() allow(ref).to receive(:name) { 'bad-branch' } allow(ref).to receive(:target) { raise Rugged::ReferenceError } branches = double() allow(branches).to receive(:each) { [ref].each } allow(repository.rugged).to receive(:branches) { branches } - end - it { is_expected.to eq([]) } + expect(subject).to be_empty + end end + + it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RefService, :branches end describe '#branch_count' do diff --git a/spec/lib/gitlab/gitaly_client/ref_service_spec.rb b/spec/lib/gitlab/gitaly_client/ref_service_spec.rb index 1e8ed9d645b..0b1c890f956 100644 --- a/spec/lib/gitlab/gitaly_client/ref_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/ref_service_spec.rb @@ -6,6 +6,17 @@ describe Gitlab::GitalyClient::RefService do let(:relative_path) { project.path_with_namespace + '.git' } let(:client) { described_class.new(project.repository) } + describe '#branches' do + it 'sends a find_all_branches message' do + expect_any_instance_of(Gitaly::RefService::Stub) + .to receive(:find_all_branches) + .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) + .and_return([]) + + client.branches + end + end + describe '#branch_names' do it 'sends a find_all_branch_names message' do expect_any_instance_of(Gitaly::RefService::Stub) |