summaryrefslogtreecommitdiff
path: root/spec/gitlab_shell_spec.rb
diff options
context:
space:
mode:
authorash <smashwilson@gmail.com>2013-05-18 19:42:48 +0000
committerash <smashwilson@gmail.com>2013-05-18 19:42:48 +0000
commit90b9e113812fb566b0535e44df3f3279bf6c4438 (patch)
treee88a59cec3a9d62be6c319e093b5fe816ca3daaa /spec/gitlab_shell_spec.rb
parentceb23a6230850f26a8c3eb2282ae25af6aa23665 (diff)
downloadgitlab-shell-90b9e113812fb566b0535e44df3f3279bf6c4438.tar.gz
Allow administrators to log users by key id (faster) or by username (clearer).
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r--spec/gitlab_shell_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb
index 0367675..44dca6d 100644
--- a/spec/gitlab_shell_spec.rb
+++ b/spec/gitlab_shell_spec.rb
@@ -11,13 +11,15 @@ describe GitlabShell do
end
let(:api) do
double(GitlabNet).tap do |api|
- api.stub(discover: 'John Doe')
+ api.stub(discover: { 'name' => 'John Doe' })
api.stub(allowed?: true)
end
end
let(:key_id) { "key-#{rand(100) + 100}" }
let(:repository_path) { "/home/git#{rand(100)}/repos" }
- before { GitlabConfig.any_instance.stub(:repos_path).and_return(repository_path) }
+ before do
+ GitlabConfig.any_instance.stub(repos_path: repository_path, audit_usernames: false)
+ end
describe :initialize do
before { ssh_cmd 'git-receive-pack' }
@@ -71,6 +73,11 @@ describe GitlabShell do
message << "for user with key #{key_id}."
$logger.should_receive(:info).with(message)
end
+
+ it "should use usernames if configured to do so" do
+ GitlabConfig.any_instance.stub(audit_usernames: true)
+ $logger.should_receive(:info) { |msg| msg.should =~ /for John Doe/ }
+ end
end
context 'git-receive-pack' do