aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/spec/channel_spec.rb
diff options
context:
space:
mode:
authorGravatar Tim Emiola <temiola@google.com>2015-03-27 13:07:34 -0700
committerGravatar Tim Emiola <temiola@google.com>2015-04-10 11:23:42 -0700
commit564719d28e9d37a949062c0ffc2361d3612635e7 (patch)
treef46a8ae3fe609d4bc7af8c4d7c52ac6efd68bdc6 /src/ruby/spec/channel_spec.rb
parentb5d5fb36751e189df743c0243cc7ae2a001edb1c (diff)
Updates Channel#create_call to the new API
Diffstat (limited to 'src/ruby/spec/channel_spec.rb')
-rw-r--r--src/ruby/spec/channel_spec.rb29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb
index af73294abe..31e38d71b8 100644
--- a/src/ruby/spec/channel_spec.rb
+++ b/src/ruby/spec/channel_spec.rb
@@ -36,16 +36,13 @@ def load_test_certs
end
describe GRPC::Core::Channel do
- FAKE_HOST = 'localhost:0'
+ let(:fake_host) { 'localhost:0' }
+ let(:cq) { GRPC::Core::CompletionQueue.new }
def create_test_cert
GRPC::Core::Credentials.new(load_test_certs[0])
end
- before(:each) do
- @cq = GRPC::Core::CompletionQueue.new
- end
-
shared_examples '#new' do
it 'take a host name without channel args' do
expect { GRPC::Core::Channel.new('dummy_host', nil) }.not_to raise_error
@@ -115,25 +112,23 @@ describe GRPC::Core::Channel do
describe '#create_call' do
it 'creates a call OK' do
- host = FAKE_HOST
- ch = GRPC::Core::Channel.new(host, nil)
+ ch = GRPC::Core::Channel.new(fake_host, nil)
deadline = Time.now + 5
blk = proc do
- ch.create_call('dummy_method', 'dummy_host', deadline)
+ ch.create_call(cq, 'dummy_method', 'dummy_host', deadline)
end
expect(&blk).to_not raise_error
end
it 'raises an error if called on a closed channel' do
- host = FAKE_HOST
- ch = GRPC::Core::Channel.new(host, nil)
+ ch = GRPC::Core::Channel.new(fake_host, nil)
ch.close
deadline = Time.now + 5
blk = proc do
- ch.create_call('dummy_method', 'dummy_host', deadline)
+ ch.create_call(cq, 'dummy_method', 'dummy_host', deadline)
end
expect(&blk).to raise_error(RuntimeError)
end
@@ -141,15 +136,13 @@ describe GRPC::Core::Channel do
describe '#destroy' do
it 'destroys a channel ok' do
- host = FAKE_HOST
- ch = GRPC::Core::Channel.new(host, nil)
+ ch = GRPC::Core::Channel.new(fake_host, nil)
blk = proc { ch.destroy }
expect(&blk).to_not raise_error
end
it 'can be called more than once without error' do
- host = FAKE_HOST
- ch = GRPC::Core::Channel.new(host, nil)
+ ch = GRPC::Core::Channel.new(fake_host, nil)
blk = proc { ch.destroy }
blk.call
expect(&blk).to_not raise_error
@@ -164,15 +157,13 @@ describe GRPC::Core::Channel do
describe '#close' do
it 'closes a channel ok' do
- host = FAKE_HOST
- ch = GRPC::Core::Channel.new(host, nil)
+ ch = GRPC::Core::Channel.new(fake_host, nil)
blk = proc { ch.close }
expect(&blk).to_not raise_error
end
it 'can be called more than once without error' do
- host = FAKE_HOST
- ch = GRPC::Core::Channel.new(host, nil)
+ ch = GRPC::Core::Channel.new(fake_host, nil)
blk = proc { ch.close }
blk.call
expect(&blk).to_not raise_error