test/test_websocket.rb in jellyfish-1.1.1 vs test/test_websocket.rb in jellyfish-1.2.0

- old
+ new

@@ -1,10 +1,12 @@ require 'jellyfish/test' require 'stringio' -describe Jellyfish do +describe Jellyfish::WebSocket do + paste :stringio + after do Muack.verify end app = Class.new do @@ -19,10 +21,11 @@ end end.new def create_env sock = StringIO.new + sock.set_encoding('ASCII-8BIT') mock(IO).select([sock]) do # or EOFError, not sure why? sock << WebSocket::Message.new('pong').to_data * 2 [[sock], [], []] end [{'REQUEST_METHOD' => 'GET', 'PATH_INFO' => '/echo', @@ -30,15 +33,15 @@ end would 'ping pong' do env, sock = create_env app.call(env) - sock.string.should.eq <<-HTTP.chomp + sock.string.should.eq <<-HTTP.chomp.force_encoding('ASCII-8BIT') HTTP/1.1 101 Switching Protocols\r Upgrade: websocket\r Connection: Upgrade\r Sec-WebSocket-Accept: Kfh9QIsMVZcl6xEPYxPHzW8SZ8w=\r \r -\x81\u0004ping\x81\u0004pong\x81\u0004pong +\x81\x04ping\x81\x04pong\x81\x04pong HTTP end end