Sha256: 1a47a53b973a2f283dceba9f1642e92dc8a9782ecbf83092eb108abdaa814e57

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 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

2 entries across 2 versions & 1 rubygems

Version Path
faye-websocket-0.4.7-java spec/faye/websocket/draft75_parser_spec.rb
faye-websocket-0.4.7 spec/faye/websocket/draft75_parser_spec.rb