Sha256: 586009b4daf849ef4734df522944f39e828882784c095292036aac7431de35ad
Contents?: true
Size: 799 Bytes
Versions: 2
Compression:
Stored size: 799 Bytes
Contents
require 'spec_helper' module LIFX describe GatewayConnection do subject(:gateway) { GatewayConnection.new } let(:message) { double(Message, is_a?: true, pack: '') } let(:ip) { '127.0.0.1' } let(:port) { 35_003 } after { gateway.close } context 'write queue resiliency' do it 'does not send if there is no available connection' do expect(gateway).to_not receive(:actually_write) gateway.write(message) expect { gateway.flush(timeout: 0.5) }.to raise_error(TimeoutError) end it 'pushes message back into queue if unable to write' do gateway.connect_udp(ip, port) expect(gateway).to receive(:actually_write).and_return(false, true) gateway.write(message) gateway.flush end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lifx-0.4.11 | spec/gateway_connection_spec.rb |
lifx-0.4.10 | spec/gateway_connection_spec.rb |