summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/gitaly_client_spec.rb
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-04 14:56:27 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-04 14:56:27 +0100
commitccca73d779ae0e22a86c9586fd52b15a8600b9f3 (patch)
tree7385d9a2019bfa98affe9bc83c0afd7da2fd730d /spec/lib/gitlab/gitaly_client_spec.rb
parentc252c03401881fd7dbf7fab984285c402eb31d5f (diff)
parent5f7ebfb9aa023849b8b296bf9cf0f472b886d072 (diff)
downloadgitlab-ce-ccca73d779ae0e22a86c9586fd52b15a8600b9f3.tar.gz
Merge branch 'master' into add-sentry-js-again-with-vue
Diffstat (limited to 'spec/lib/gitlab/gitaly_client_spec.rb')
-rw-r--r--spec/lib/gitlab/gitaly_client_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gitaly_client_spec.rb b/spec/lib/gitlab/gitaly_client_spec.rb
new file mode 100644
index 00000000000..55fcf91fb6e
--- /dev/null
+++ b/spec/lib/gitlab/gitaly_client_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe Gitlab::GitalyClient, lib: true do
+ describe '.new_channel' do
+ context 'when passed a UNIX socket address' do
+ it 'passes the address as-is to GRPC::Core::Channel initializer' do
+ address = 'unix:/tmp/gitaly.sock'
+
+ expect(GRPC::Core::Channel).to receive(:new).with(address, any_args)
+
+ described_class.new_channel(address)
+ end
+ end
+
+ context 'when passed a TCP address' do
+ it 'strips tcp:// prefix before passing it to GRPC::Core::Channel initializer' do
+ address = 'localhost:9876'
+ prefixed_address = "tcp://#{address}"
+
+ expect(GRPC::Core::Channel).to receive(:new).with(address, any_args)
+
+ described_class.new_channel(prefixed_address)
+ end
+ end
+ end
+end