Sha256: 02746aa8b9d72556404d2aca175d6f545a538e45109bb9561aec38329285bacc

Contents?: true

Size: 728 Bytes

Versions: 11

Compression:

Stored size: 728 Bytes

Contents

# encoding=utf-8

require "spec_helper"

describe Faye::WebSocket::Draft75Parser do
  include EncodingHelper
  
  before do
    @web_socket = mock Faye::WebSocket
    @parser = Faye::WebSocket::Draft75Parser.new(@web_socket)
  end
  
  describe :parse do
    it_should_behave_like "draft-75 parser"
  end
  
  describe :frame do
    it "returns the given string formatted as a WebSocket frame" do
      bytes(@parser.frame "Hello").should == [0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0xff]
    end
    
    it "encodes multibyte characters correctly" do
      message = encode "Apple = "
      bytes(@parser.frame message).should == [0x00, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0xef, 0xa3, 0xbf, 0xff]
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
faye-websocket-0.4.6-java spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.6 spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.5-java spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.5 spec/faye/websocket/draft75_parser_spec.rb
_bushido-faye-websocket-0.4.4 spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.4-java spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.4 spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.3 spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.2 spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.1 spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.0 spec/faye/websocket/draft75_parser_spec.rb