aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/spec/channel_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'src/ruby/spec/channel_spec.rb')
-rw-r--r--src/ruby/spec/channel_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb
index 740eac631a..a289a00f04 100644
--- a/src/ruby/spec/channel_spec.rb
+++ b/src/ruby/spec/channel_spec.rb
@@ -153,6 +153,35 @@ describe GRPC::Core::Channel do
end
end
+ describe '#connectivity_state' do
+ it 'returns an enum' do
+ ch = GRPC::Core::Channel.new(fake_host, nil, :this_channel_is_insecure)
+ valid_states = [
+ GRPC::Core::ConnectivityStates::IDLE,
+ GRPC::Core::ConnectivityStates::CONNECTING,
+ GRPC::Core::ConnectivityStates::READY,
+ GRPC::Core::ConnectivityStates::TRANSIENT_FAILURE,
+ GRPC::Core::ConnectivityStates::FATAL_FAILURE
+ ]
+
+ expect(valid_states).to include(ch.connectivity_state)
+ end
+
+ it 'returns an enum when trying to connect' do
+ ch = GRPC::Core::Channel.new(fake_host, nil, :this_channel_is_insecure)
+ ch.connectivity_state(true)
+ valid_states = [
+ GRPC::Core::ConnectivityStates::IDLE,
+ GRPC::Core::ConnectivityStates::CONNECTING,
+ GRPC::Core::ConnectivityStates::READY,
+ GRPC::Core::ConnectivityStates::TRANSIENT_FAILURE,
+ GRPC::Core::ConnectivityStates::FATAL_FAILURE
+ ]
+
+ expect(valid_states).to include(ch.connectivity_state)
+ end
+ end
+
describe '::SSL_TARGET' do
it 'is a symbol' do
expect(GRPC::Core::Channel::SSL_TARGET).to be_a(Symbol)