From d670c3006e6e44901bce0d53cc4768d1d80ffa92 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 17 Jun 2021 10:07:47 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-0-stable-ee --- .../gitlab/gitaly_client/remote_service_spec.rb | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'spec/lib/gitlab/gitaly_client') diff --git a/spec/lib/gitlab/gitaly_client/remote_service_spec.rb b/spec/lib/gitlab/gitaly_client/remote_service_spec.rb index df9dde324a5..2ec5f70be76 100644 --- a/spec/lib/gitlab/gitaly_client/remote_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/remote_service_spec.rb @@ -67,13 +67,29 @@ RSpec.describe Gitlab::GitalyClient::RemoteService do let(:ssh_key) { 'KEY' } let(:known_hosts) { 'KNOWN HOSTS' } - it 'sends an update_remote_mirror message' do - expect_any_instance_of(Gitaly::RemoteService::Stub) - .to receive(:update_remote_mirror) - .with(kind_of(Enumerator), kind_of(Hash)) - .and_return(double(:update_remote_mirror_response)) + shared_examples 'an update' do + it 'sends an update_remote_mirror message' do + expect_any_instance_of(Gitaly::RemoteService::Stub) + .to receive(:update_remote_mirror) + .with(array_including(gitaly_request_with_params(expected_params)), kind_of(Hash)) + .and_return(double(:update_remote_mirror_response)) + + client.update_remote_mirror(ref_name, url, only_branches_matching, ssh_key: ssh_key, known_hosts: known_hosts, keep_divergent_refs: true) + end + end + + context 'with remote name' do + let(:url) { nil } + let(:expected_params) { { ref_name: ref_name } } + + it_behaves_like 'an update' + end + + context 'with remote URL' do + let(:url) { 'http:://git.example.com/my-repo.git' } + let(:expected_params) { { remote: Gitaly::UpdateRemoteMirrorRequest::Remote.new(url: url) } } - client.update_remote_mirror(ref_name, only_branches_matching, ssh_key: ssh_key, known_hosts: known_hosts, keep_divergent_refs: true) + it_behaves_like 'an update' end end -- cgit v1.2.1