spec/acceptance/realtime/connection_failures_spec.rb in ably-0.8.7 vs spec/acceptance/realtime/connection_failures_spec.rb in ably-0.8.8
- old
+ new
@@ -479,12 +479,10 @@
end
end
end
it 'retains channel subscription state' do
- messages_received = false
-
channel.subscribe('event') do |message|
expect(message.data).to eql('message')
stop_reactor
end
@@ -710,10 +708,11 @@
end
context 'when the Internet is up' do
before do
allow(connection).to receive(:internet_up?).and_yield(true)
+ @suspended = 0
end
it 'uses a fallback host on every subsequent disconnected attempt until suspended' do
request = 0
expect(EventMachine).to receive(:connect).exactly(retry_count_for_one_state).times do |host|
@@ -738,17 +737,16 @@
expect(EventMachine).to receive(:connect).at_least(:once) do |host|
if request == 0 || request == expected_retry_attempts + 1
expect(host).to eql(expected_host)
else
expect(custom_hosts).to include(host)
- fallback_hosts_used << host if @suspended
+ fallback_hosts_used << host if @suspended > 0
end
request += 1
raise EventMachine::ConnectionError
end
connection.on(:suspended) do
- @suspended ||= 0
@suspended += 1
if @suspended > 3
expect(fallback_hosts_used.uniq).to match_array(custom_hosts)
stop_reactor