spec/unit/framing_spec.rb in em-websocket-0.3.6 vs spec/unit/framing_spec.rb in em-websocket-0.3.7
- old
+ new
@@ -2,10 +2,17 @@
describe EM::WebSocket::Framing03 do
class FramingContainer
include EM::WebSocket::Framing03
+ def initialize
+ @connection = Object.new
+ def @connection.max_frame_size
+ 1000000
+ end
+ end
+
def <<(data)
@data << data
process_data(data)
end
@@ -120,10 +127,17 @@
# http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-03#section-4.6
describe EM::WebSocket::Framing04 do
class FramingContainer04
include EM::WebSocket::Framing04
+ def initialize
+ @connection = Object.new
+ def @connection.max_frame_size
+ 1000000
+ end
+ end
+
def <<(data)
@data << data
process_data(data)
end
@@ -182,10 +196,17 @@
describe EM::WebSocket::Framing07 do
class FramingContainer07
include EM::WebSocket::Framing07
+ def initialize
+ @connection = Object.new
+ def @connection.max_frame_size
+ 1000000
+ end
+ end
+
def <<(data)
@data << data
process_data(data)
end
@@ -238,14 +259,14 @@
@f << "\x82\x7F\x00\x00\x00\x00\x00\x01\x00\x00" + data
end
end
describe "other tests" do
- it "should raise a DataError if an invalid frame type is requested" do
+ it "should raise a WSProtocolError 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")
+ }.should raise_error(EventMachine::WebSocket::WSProtocolError, "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"