Skip to content

Commit fdf0882

Browse files
committed
add spec for system call errors
see njh#159
1 parent 4714361 commit fdf0882

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/mqtt/client_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,12 @@ def register_for_ack(packet)
868868
client.send(:receive_packet)
869869
end
870870

871+
it "closes the socket if there is a system call error" do
872+
expect(socket).to receive(:close).once
873+
allow(MQTT::Packet).to receive(:read).and_raise(Errno::ECONNRESET)
874+
client.send(:receive_packet)
875+
end
876+
871877
it "passes exceptions up to parent thread" do
872878
client.reconnect_limit = 0
873879
allow(MQTT::Packet).to receive(:read).and_raise(MQTT::Exception)

0 commit comments

Comments
 (0)