summaryrefslogtreecommitdiff
path: root/spec/gitlab_shell_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r--spec/gitlab_shell_spec.rb11
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)