spec/acceptance/realtime/connection_spec.rb in ably-1.1.1 vs spec/acceptance/realtime/connection_spec.rb in ably-1.1.2
- old
+ new
@@ -25,10 +25,17 @@
expect(connection.state).to eq(:connected)
stop_reactor
end
end
+ context 'current_host' do
+ it 'is available immediately after the client is instanced' do
+ expect(connection.current_host.to_s).to match(/\.ably\.io$/)
+ stop_reactor
+ end
+ end
+
context 'with :auto_connect option set to false' do
let(:client) do
auto_close Ably::Realtime::Client.new(default_options.merge(auto_connect: false))
end
@@ -1305,16 +1312,18 @@
channel.attach do
expect(connection.send(:client_msg_serial)).to eql(-1) # no messages published yet
connection_id = client.connection.id
connection.transport.__incoming_protocol_msgbus__
- channel.publish('event', 'message-1') do
+ channel.subscribe('event') do |message|
+ expect(message.data).to eql('message-1')
msg_serial = connection.send(:client_msg_serial)
expect(msg_serial).to eql(0)
recovery_key = client.connection.recovery_key
connection.transition_state_machine! :failed
end
+ channel.publish('event', 'message-1')
end
connection.on(:failed) do
recover_client = auto_close Ably::Realtime::Client.new(default_options.merge(recover: recovery_key))
recover_client_channel = recover_client.channel(channel_name)
@@ -1327,10 +1336,10 @@
recover_client_channel.attach do
expect(recover_client.connection.id).to eql(connection_id)
recover_client_channel.subscribe do |message|
- raise "Unexpected message #{message}" if message.data != 'message-2'
+ expect(message.data).to eql('message-2')
EventMachine.add_timer(2) do
stop_reactor
end
end
end