diff options
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r-- | spec/gitlab_shell_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index 5df2391..4ca7984 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -135,6 +135,27 @@ describe GitlabShell do api.should_receive(:discover).with(key_id) end end + + context "failed connection" do + before { + ssh_cmd 'git-upload-pack gitlab-ci.git' + api.stub(:check_access).and_raise(GitlabNet::ApiUnreachableError) + } + after { subject.exec } + + it "should not process the command" do + subject.should_not_receive(:process_cmd) + end + + it "should not execute the command" do + subject.should_not_receive(:exec_cmd) + end + + it "should log the failed connection" do + message = "gitlab-shell: Failed to connect to internal API" + $logger.should_receive(:warn).with(message) + end + end end describe :validate_access do |