summaryrefslogtreecommitdiff
path: root/spec/gitlab_net_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r--spec/gitlab_net_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index e9a9d03..17fb56d 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -26,6 +26,11 @@ describe GitlabNet, vcr: true do
gitlab_net.check
end
end
+
+ it "raises an exception if the connection fails" do
+ Net::HTTP.any_instance.stub(:request).and_raise(StandardError)
+ expect { gitlab_net.check }.to raise_error(GitlabNet::ApiUnreachableError)
+ end
end
describe :discover do
@@ -42,6 +47,13 @@ describe GitlabNet, vcr: true do
gitlab_net.discover('key-126')
end
end
+
+ it "raises an exception if the connection fails" do
+ VCR.use_cassette("discover-ok") do
+ Net::HTTP.any_instance.stub(:request).and_raise(StandardError)
+ expect { gitlab_net.discover('key-126') }.to raise_error(GitlabNet::ApiUnreachableError)
+ end
+ end
end
describe :broadcast_message do
@@ -110,6 +122,13 @@ describe GitlabNet, vcr: true do
end
end
end
+
+ it "raises an exception if the connection fails" do
+ Net::HTTP.any_instance.stub(:request).and_raise(StandardError)
+ expect {
+ gitlab_net.check_access('git-upload-pack', 'gitlab/gitlabhq.git', 'user-1', changes)
+ }.to raise_error(GitlabNet::ApiUnreachableError)
+ end
end
describe :host do