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
end
def auth_scope
URI.parse(primary_repo).path.gsub(/(^\/|\.git$)/, '')
URI.parse(primary_repo).path.gsub(%r{^\/|\.git$}, '')
end
def get(url, headers)
......
......@@ -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}" }
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)
subject.info_refs
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
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