From 4889f743fbb17946554168f51d304451522cce5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A0TheSmartnik?= Date: Mon, 13 Sep 2021 18:09:55 +0300 Subject: [PATCH] RTN-13c Add spec that channels do not reattach when connection isn't connected --- spec/acceptance/realtime/channel_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spec/acceptance/realtime/channel_spec.rb b/spec/acceptance/realtime/channel_spec.rb index 03ca1f3a8..8f437aad6 100644 --- a/spec/acceptance/realtime/channel_spec.rb +++ b/spec/acceptance/realtime/channel_spec.rb @@ -2224,6 +2224,27 @@ def fake_error(error) channel.transition_state_machine! :suspended end end + + context 'when connection is no longer connected' do + it 'will not attempt to reattach (#RTL13c)' do + channel.attach do + connection.once(:closing) do + channel.once(:attaching) do |state_change| + raise 'Channel should not attempt to reattach' + end + + channel.transition_state_machine! :suspended + end + + connection.once(:closed) do + expect(channel).to be_suspended + stop_reactor + end + + connection.close + end + end + end end context 'and channel is attaching' do