spec/reel/websocket_spec.rb in reel-0.6.0 vs spec/reel/websocket_spec.rb in reel-0.6.1

- old
+ new

@@ -171,9 +171,23 @@ expect(case_handshake.errors).to be_empty end end + it "pings clients" do + with_websocket_pair do |client, websocket| + websocket.ping "<3" + + pinger = double "pinger" + expect(pinger).to receive(:ping) { |msg| expect(msg).to eq("<3") } + + parser = WebSocket::Parser.new + parser.on_ping { |msg| pinger.ping msg } + + parser << client.readpartial(4096) + end + end + def with_websocket_pair with_socket_pair do |client, peer| connection = Reel::Connection.new(peer) client << handshake.to_data request = connection.request