Commit 085fce8d authored by Valery Sizov's avatar Valery Sizov

Addressing review comments. Added tests and some style changes

parent 77faae49
...@@ -110,7 +110,7 @@ module Gitlab ...@@ -110,7 +110,7 @@ module Gitlab
end end
def auth_scope def auth_scope
URI.parse(primary_repo).path.gsub(/(^\/|\.git$)/, '') URI.parse(primary_repo).path.gsub(%r{^\/|\.git$}, '')
end end
def get(url, headers) def get(url, headers)
......
...@@ -70,11 +70,17 @@ describe Gitlab::Geo::GitPushSSHProxy, :geo do ...@@ -70,11 +70,17 @@ describe Gitlab::Geo::GitPushSSHProxy, :geo do
let(:info_refs_http_body_full) { "001f# service=git-receive-pack\n0000#{info_refs_body_short}" } let(:info_refs_http_body_full) { "001f# service=git-receive-pack\n0000#{info_refs_body_short}" }
context 'authorization header is scoped' do context 'authorization header is scoped' do
it 'returns a Gitlab::Geo::GitPushSSHProxy::APIResponse' do it 'passes the scope when .info_refs is called' do
expect(Gitlab::Geo::BaseRequest).to receive(:new).with(scope: project.repository.full_path) expect(Gitlab::Geo::BaseRequest).to receive(:new).with(scope: project.repository.full_path)
subject.info_refs subject.info_refs
end end
it 'passes the scope when .push is called' do
expect(Gitlab::Geo::BaseRequest).to receive(:new).with(scope: project.repository.full_path)
subject.push(info_refs_body_short)
end
end end
context 'with a failed response' do context 'with a failed response' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment