From 5d8666d75f97fcdabc4e684c5765aa103560e714 Mon Sep 17 00:00:00 2001 From: James Coglan Date: Mon, 19 Dec 2011 00:20:17 +0000 Subject: [PATCH] Test WebSocket#protocol method. --- spec/faye/websocket/client_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/faye/websocket/client_spec.rb b/spec/faye/websocket/client_spec.rb index ad50bd6..72b3b6e 100644 --- a/spec/faye/websocket/client_spec.rb +++ b/spec/faye/websocket/client_spec.rb @@ -50,6 +50,11 @@ WebSocketSteps = EM::RSpec.async_steps do callback.call end + def check_protocol(protocol, &callback) + @ws.protocol.should == protocol + callback.call + end + def listen_for_message(&callback) @ws.add_event_listener('message', lambda { |e| @message = e.data }) callback.call @@ -87,6 +92,7 @@ describe Faye::WebSocket::Client do it "can open a connection" do open_socket(socket_url, protocols) check_open + check_protocol("echo") end it "cannot open a connection to the wrong host" do