aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/spec/call_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'src/ruby/spec/call_spec.rb')
-rw-r--r--src/ruby/spec/call_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb
index 473ff4a8bd..1cc0500242 100644
--- a/src/ruby/spec/call_spec.rb
+++ b/src/ruby/spec/call_spec.rb
@@ -137,6 +137,39 @@ describe GRPC::Core::Call do
end
end
+ describe '#cancel' do
+ it 'completes ok' do
+ call = make_test_call
+ expect { call.cancel }.not_to raise_error
+ end
+
+ it 'completes ok when the call is closed' do
+ call = make_test_call
+ call.close
+ expect { call.cancel }.not_to raise_error
+ end
+ end
+
+ describe '#cancel_with_status' do
+ it 'completes ok' do
+ call = make_test_call
+ expect do
+ call.cancel_with_status(0, 'test status')
+ end.not_to raise_error
+ expect do
+ call.cancel_with_status(0, nil)
+ end.to raise_error(TypeError)
+ end
+
+ it 'completes ok when the call is closed' do
+ call = make_test_call
+ call.close
+ expect do
+ call.cancel_with_status(0, 'test status')
+ end.not_to raise_error
+ end
+ end
+
def make_test_call
@ch.create_call(nil, nil, 'dummy_method', nil, deadline)
end