diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-19 14:31:34 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-19 14:31:34 +0200 |
commit | 11311a95545f967a5736cd16ab5fc37f7e658519 (patch) | |
tree | 484912f3b5b690c67080fd0b2d564c3dfb67924d /spec/gitlab_shell_spec.rb | |
parent | 45444597aef3e434571de2491934ae92357ad231 (diff) | |
parent | 80f5af48e2c66c3f61218f9c7e85f74c634ea8df (diff) | |
download | gitlab-shell-11311a95545f967a5736cd16ab5fc37f7e658519.tar.gz |
Merge branch 'git_hook_messages'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
VERSION
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r-- | spec/gitlab_shell_spec.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index 4741303..5df2391 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -1,5 +1,6 @@ require_relative 'spec_helper' require_relative '../lib/gitlab_shell' +require_relative '../lib/gitlab_access_status' describe GitlabShell do subject do @@ -12,7 +13,7 @@ describe GitlabShell do let(:api) do double(GitlabNet).tap do |api| api.stub(discover: { 'name' => 'John Doe' }) - api.stub(allowed?: true) + api.stub(check_access: GitAccessStatus.new(true)) end end let(:key_id) { "key-#{rand(100) + 100}" } @@ -140,13 +141,13 @@ describe GitlabShell do before { ssh_cmd 'git-upload-pack gitlab-ci.git' } after { subject.exec } - it "should call api.allowed?" do - api.should_receive(:allowed?). + it "should call api.check_access" do + api.should_receive(:check_access). with('git-upload-pack', 'gitlab-ci.git', key_id, '_any') end - it "should disallow access and log the attempt if allowed? returns false" do - api.stub(allowed?: false) + it "should disallow access and log the attempt if check_access returns false status" do + api.stub(check_access: GitAccessStatus.new(false)) message = "gitlab-shell: Access denied for git command <git-upload-pack gitlab-ci.git> " message << "by user with key #{key_id}." $logger.should_receive(:warn).with(message) |