summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git/user_spec.rb
diff options
context:
space:
mode:
authorDavid Turner <dturner@twosigma.com>2017-08-02 14:14:50 -0400
committerDavid Turner <novalis@novalis.org>2017-09-29 18:12:03 -0400
commitdbcf48af8b21c0f1e54b73ea421911028081e1c1 (patch)
tree079829ac40d22cd745749d8cfaf5c56c21c4112d /spec/lib/gitlab/git/user_spec.rb
parent999b7e553b1e1e04c2be4289b94557813f140cfe (diff)
downloadgitlab-ce-dbcf48af8b21c0f1e54b73ea421911028081e1c1.tar.gz
Add username as GL_USERNAME in hooks (http)
When calling pre-receive, post-receive, and update hooks, add the GitLab username as the GL_USERNAME environment variable. This patch only handles cases where pushes are over http, or via the web interface. Later, we will address the ssh case.
Diffstat (limited to 'spec/lib/gitlab/git/user_spec.rb')
-rw-r--r--spec/lib/gitlab/git/user_spec.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/lib/gitlab/git/user_spec.rb b/spec/lib/gitlab/git/user_spec.rb
index 0ebcecb26c0..ab64b041187 100644
--- a/spec/lib/gitlab/git/user_spec.rb
+++ b/spec/lib/gitlab/git/user_spec.rb
@@ -1,22 +1,24 @@
require 'spec_helper'
describe Gitlab::Git::User do
+ let(:username) { 'janedo' }
let(:name) { 'Jane Doe' }
let(:email) { 'janedoe@example.com' }
let(:gl_id) { 'user-123' }
- subject { described_class.new(name, email, gl_id) }
+ subject { described_class.new(username, name, email, gl_id) }
describe '#==' do
- def eq_other(name, email, gl_id)
- eq(described_class.new(name, email, gl_id))
+ def eq_other(username, name, email, gl_id)
+ eq(described_class.new(username, name, email, gl_id))
end
- it { expect(subject).to eq_other(name, email, gl_id) }
+ it { expect(subject).to eq_other(username, name, email, gl_id) }
- it { expect(subject).not_to eq_other(nil, nil, nil) }
- it { expect(subject).not_to eq_other(name + 'x', email, gl_id) }
- it { expect(subject).not_to eq_other(name, email + 'x', gl_id) }
- it { expect(subject).not_to eq_other(name, email, gl_id + 'x') }
+ it { expect(subject).not_to eq_other(nil, nil, nil, nil) }
+ it { expect(subject).not_to eq_other(username + 'x', name, email, gl_id) }
+ it { expect(subject).not_to eq_other(username, name + 'x', email, gl_id) }
+ it { expect(subject).not_to eq_other(username, name, email + 'x', gl_id) }
+ it { expect(subject).not_to eq_other(username, name, email, gl_id + 'x') }
end
end