diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-11-20 11:06:27 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-11-20 11:06:27 +0100 |
commit | f8453da5868dd7a23d0f2f3da7a45e33c441d1db (patch) | |
tree | 4287dcaab5a9b0e8be14e82104a109ca9349b81a /spec/gitlab_shell_spec.rb | |
parent | 11311a95545f967a5736cd16ab5fc37f7e658519 (diff) | |
download | gitlab-shell-f8453da5868dd7a23d0f2f3da7a45e33c441d1db.tar.gz |
Revert "Merge branch 'git_hook_messages'"
At least the following things were broken:
- missing require for 'gitlab_access_status' in lib/gitlab_net.rb
- gitlabhq master internal API returns 'true' or 'false', gitlab-shell
expects JSON
This reverts commit 11311a95545f967a5736cd16ab5fc37f7e658519, reversing
changes made to 45444597aef3e434571de2491934ae92357ad231.
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r-- | spec/gitlab_shell_spec.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index 5df2391..4741303 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -1,6 +1,5 @@ require_relative 'spec_helper' require_relative '../lib/gitlab_shell' -require_relative '../lib/gitlab_access_status' describe GitlabShell do subject do @@ -13,7 +12,7 @@ describe GitlabShell do let(:api) do double(GitlabNet).tap do |api| api.stub(discover: { 'name' => 'John Doe' }) - api.stub(check_access: GitAccessStatus.new(true)) + api.stub(allowed?: true) end end let(:key_id) { "key-#{rand(100) + 100}" } @@ -141,13 +140,13 @@ describe GitlabShell do before { ssh_cmd 'git-upload-pack gitlab-ci.git' } after { subject.exec } - it "should call api.check_access" do - api.should_receive(:check_access). + it "should call api.allowed?" do + api.should_receive(:allowed?). with('git-upload-pack', 'gitlab-ci.git', key_id, '_any') end - it "should disallow access and log the attempt if check_access returns false status" do - api.stub(check_access: GitAccessStatus.new(false)) + it "should disallow access and log the attempt if allowed? returns false" do + api.stub(allowed?: 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) |