diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/gitlab/gitaly_client/remote_service_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/gitaly_client/remote_service_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gitaly_client/remote_service_spec.rb | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/spec/lib/gitlab/gitaly_client/remote_service_spec.rb b/spec/lib/gitlab/gitaly_client/remote_service_spec.rb index 70fc4fe4416..df9dde324a5 100644 --- a/spec/lib/gitlab/gitaly_client/remote_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/remote_service_spec.rb @@ -38,47 +38,26 @@ RSpec.describe Gitlab::GitalyClient::RemoteService do let(:remote) { 'origin' } let(:url) { 'http://git.example.com/my-repo.git' } let(:auth) { 'Basic secret' } + let(:expected_params) { { remote_url: url, http_authorization_header: auth } } - shared_examples 'a find_remote_root_ref call' do - it 'sends an find_remote_root_ref message and returns the root ref' do - expect_any_instance_of(Gitaly::RemoteService::Stub) - .to receive(:find_remote_root_ref) - .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) - .with(gitaly_request_with_params(expected_params), kind_of(Hash)) - .and_return(double(ref: 'master')) - - expect(client.find_remote_root_ref(remote, url, auth)).to eq 'master' - end - - it 'ensure ref is a valid UTF-8 string' do - expect_any_instance_of(Gitaly::RemoteService::Stub) - .to receive(:find_remote_root_ref) - .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) - .with(gitaly_request_with_params(expected_params), kind_of(Hash)) - .and_return(double(ref: "an_invalid_ref_\xE5")) - - expect(client.find_remote_root_ref(remote, url, auth)).to eq "an_invalid_ref_å" - end - end - - context 'with inmemory feature enabled' do - before do - stub_feature_flags(find_remote_root_refs_inmemory: true) - end + it 'sends an find_remote_root_ref message and returns the root ref' do + expect_any_instance_of(Gitaly::RemoteService::Stub) + .to receive(:find_remote_root_ref) + .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) + .with(gitaly_request_with_params(expected_params), kind_of(Hash)) + .and_return(double(ref: 'master')) - it_behaves_like 'a find_remote_root_ref call' do - let(:expected_params) { { remote_url: url, http_authorization_header: auth } } - end + expect(client.find_remote_root_ref(remote, url, auth)).to eq 'master' end - context 'with inmemory feature disabled' do - before do - stub_feature_flags(find_remote_root_refs_inmemory: false) - end + it 'ensure ref is a valid UTF-8 string' do + expect_any_instance_of(Gitaly::RemoteService::Stub) + .to receive(:find_remote_root_ref) + .with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash)) + .with(gitaly_request_with_params(expected_params), kind_of(Hash)) + .and_return(double(ref: "an_invalid_ref_\xE5")) - it_behaves_like 'a find_remote_root_ref call' do - let(:expected_params) { { remote: remote } } - end + expect(client.find_remote_root_ref(remote, url, auth)).to eq "an_invalid_ref_å" end end |