spec/acceptance/realtime/connection_spec.rb in ably-1.2.0 vs spec/acceptance/realtime/connection_spec.rb in ably-1.2.1

- old
+ new

@@ -480,9 +480,29 @@ expect(been_disconnected).to be_truthy stop_reactor end end + context "when can't connect to host" do + let(:client_options) { super().merge(realtime_host: 'non-existent.ably.io') } + + it 'logs error on failed connection attempt' do + logger_expectation = lambda do |*args, &block| + error_message = "Connection to non-existent.ably.io:443 failed" + expect(args.concat([block ? block.call : nil]).join(',')).to include(error_message) + stop_reactor + end + + expect(connection.logger).to receive(:warn, &logger_expectation).at_least(:once) + + connection.on(:connected) do + raise "Connection should not succeed" + end + + connection.connect + end + end + context 'when explicitly reconnecting disconnected/suspended connection in retry (#RTN11c)' do let(:close_connection_proc) do lambda do EventMachine.add_timer(0.001) do if connection.transport.nil?