diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:10:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:10:08 +0300 |
commit | ec4abad65d774cfc94110577589d44de5da825de (patch) | |
tree | c51897390fa0a749bcd414d1ee1c2007fa9c3ec7 /spec/lib/gitlab/gitaly_client/remote_service_spec.rb | |
parent | 111e0ef1fa06e79adf73a34ebd14f71bfeb99bff (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/gitaly_client/remote_service_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gitaly_client/remote_service_spec.rb | 28 |
1 files changed, 22 insertions, 6 deletions
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 |