spec/unit/framing_spec.rb in em-websocket-0.3.1 vs spec/unit/framing_spec.rb in em-websocket-0.3.2

- old
+ new

@@ -94,10 +94,19 @@ @f.should_receive(:message).with(:binary, '', data) @f << "\x05\x7F\x00\x00\x00\x00\x00\x01\x00\x00" + data end end + describe "other tests" do + it "should accept a fragmented unmasked text message in 3 frames" do + @f.should_receive(:message).with(:text, '', 'Hello world') + @f << "\x84\x03Hel" + @f << "\x80\x02lo" + @f << "\x00\x06 world" + end + end + describe "error cases" do it "should raise an exception on continuation frame without preceeding more frame" do lambda { @f << 0b00000000 # Single frame, continuation @f << 0b00000001 # Length 1 @@ -158,10 +167,19 @@ data = "a"*65536 @f.should_receive(:message).with(:binary, '', data) @f << "\x85\x7F\x00\x00\x00\x00\x00\x01\x00\x00" + data end end + + describe "other tests" do + it "should accept a fragmented unmasked text message in 3 frames" do + @f.should_receive(:message).with(:text, '', 'Hello world') + @f << "\x04\x03Hel" + @f << "\x00\x02lo" + @f << "\x80\x06 world" + end + end end describe EM::WebSocket::Framing07 do class FramingContainer07 include EM::WebSocket::Framing07 @@ -225,8 +243,15 @@ it "should raise a DataError if an invalid frame type is requested" do lambda { # Opcode 3 is not supported by this draft @f << "\x83\x05Hello" }.should raise_error(EventMachine::WebSocket::DataError, "Unknown opcode") + end + + it "should accept a fragmented unmasked text message in 3 frames" do + @f.should_receive(:message).with(:text, '', 'Hello world') + @f << "\x01\x03Hel" + @f << "\x00\x02lo" + @f << "\x80\x06 world" end end end