summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-02-27 12:21:04 +0000
committerRémy Coutable <remy@rymai.me>2017-02-27 12:21:04 +0000
commitc425f366bfa84efab92b5d5e1d0721f16a2890bc (patch)
treecf15b4a5fdaa7959e81239e8202c7333eaa3f757 /spec/models
parent82f6c0f5ac4ed29390ed90592d2c431f3494d93f (diff)
parent150c3637521653a9e1200483376e4661ea2a46b3 (diff)
downloadgitlab-ce-c425f366bfa84efab92b5d5e1d0721f16a2890bc.tar.gz
Merge branch '1937-https-clone-url-username' into 'master'
Add the username of the current user to the HTTP(S) clone URL Closes #1937 See merge request !9347
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 5232c531635..ee4f4092062 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1894,4 +1894,25 @@ describe Project, models: true do
end
end
end
+
+ describe '#http_url_to_repo' do
+ let(:project) { create :empty_project }
+
+ context 'when no user is given' do
+ it 'returns the url to the repo without a username' do
+ url = project.http_url_to_repo
+
+ expect(url).to eq(project.http_url_to_repo)
+ expect(url).not_to include('@')
+ end
+ end
+
+ context 'when user is given' do
+ it 'returns the url to the repo with the username' do
+ user = build_stubbed(:user)
+
+ expect(project.http_url_to_repo(user)).to match(%r{https?:\/\/#{user.username}@})
+ end
+ end
+ end
end